mattijn / topojson

Encode spatial data as topology in Python! 🌍 https://mattijn.github.io/topojson
BSD 3-Clause "New" or "Revised" License
176 stars 27 forks source link

Keep geojson properties #146

Closed kvalev closed 2 years ago

kvalev commented 2 years ago

Hi, I noticed that all geojson feature properties are discarded when reading in the data. Is this intended?

mattijn commented 2 years ago

Hm, I think it should be copied over, can you please provide a small reproducible example including the data?

sheep-queen commented 2 years ago

missing_properties Hello, I'm having this issue as well. Note that when I copy and paste the code for input data of type "FeatureCollection or Features", the following is the JSON that is returned. Note that unlike the example response provided, this does not include the "properties": {"name": "abc"} attribute. { "type": "Topology", "objects": { "data": { "geometries": [ {"type": "Polygon", "arcs": [[-2, 0]]}, {"type": "Polygon", "arcs": [[1, 2]]} ], "type": "GeometryCollection" } }, "bbox": [0.0, 0.0, 2.0, 1.0], "arcs": [ [[1.0, 0.0], [0.0, 0.0], [0.0, 1.0], [1.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]], [[1.0, 1.0], [2.0, 1.0], [2.0, 0.0], [1.0, 0.0]] ] }

mattijn commented 2 years ago

Thanks for re-raising the issue @sheep-queen! Including an example. I can reproduce it with both shapely 1.7.1 and 1.8. Not sure what is going on.

Dave-Evans commented 2 years ago

I noticed this as well. For what it's worth, I was able to keep the properties when converting to Topology from a GeoDataFrame.

sheep-queen commented 2 years ago

I noticed this as well. For what it's worth, I was able to keep the properties when converting to Topology from a GeoDataFrame.

Thanks @Dave-Evans! That works for me too - convert my shapefile to GeoDataFrame then run topology and output as TopoJSON.

mattijn commented 2 years ago

Issue is fixed by #154