Grasshopper

algorithmic modeling for Rhino

here is a python script that export vertex and attributes to GEOJSON format.

GEOJSON_export: A Plugin that export surfaces and its attributes to a GEOJSON file
 -----------------------------------
Need pygeoj.py It must be in your script's folder
by Karim Bahgat https://github.com/karimbahgat
-----------------------------------
TODO :
use something like : https://github.com/karimbahgat/PyCRS
-----------------------------------

 Copyright (c) 2015, Guillaume Meunier <alliages@gmail.com>
 GEOJSON_export is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
 
GEOJSON_export is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

GNU General Public License a href="http://www.gnu.org/licenses/&gt">http://www.gnu.org/licenses/&gt;.
 
@license GPL-3.0+ a href="http://spdx.org/licenses/GPL-3.0+&gt">http://spdx.org/licenses/GPL-3.0+&gt;

-

    Args:
        path: path where to export
        filename: filename of your JSON without its extension (GEOJSON added)
        using_keys: which key attributes to export, 'id' by default
        s_names: values of 'id' key
        s_keys: normally each surfaces user attributes' keys
        s_values: normally each surfaces user attributes' values
        s_vertex: vertex of each surfaces
        run: do the export
        
    Returns:
        out: various information
        coordiantes: coordinates in JSON format
        properties: properties in JSON format

VER 1.3

few bugfixes

31_5_2016

VER 1.2

create multipolygon (with holes and multiple objects)

23_3_2016

-----

VER 1.1

resolved problem with geometry check in qgis by closing completely polygon

5_1_2016

---

VER 1.0

3_12_2015

In Extra category

code is here : https://gist.github.com/Alliages/8dbfce7cdd24383342b0

Views: 2881

Attachments:

Replies to This Discussion

Hey Guillaume,

many thanks for your script!!

Everything is running good but looks like a string is missed to be printed.

As you can see in the screenshot I need to have "type": "Feature" ( highlighted since I have manually typed in it) printed the same as "properties" and "geometry". Can you tell how to do it?

Thanks

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service