aspectumapp / osm2geojson

Convert OSM and Overpass XML/JSON to GeoJSON
MIT License
97 stars 15 forks source link

The result will miss a lot geometry due to the used strategy #9

Closed wuzyzy closed 4 years ago

wuzyzy commented 4 years ago

I find that the result made by this tool is different from the output in osmtogeojson. I believe the reason is the 'used strategy' in your code. Maybe you output all geometry?

rapkin commented 4 years ago

Now all used refs are filtered by this block of code https://github.com/aspectumapp/osm2geojson/blob/master/osm2geojson/main.py#L76. I can make option to extract all geometries, something like this

osm2geojson(some_xml, filter_used_refs=False)

Will be helpfull if you will provide small example for this problem

wuzyzy commented 4 years ago

Cool! For the example, you can produce a overpass quried osm json in the overpass turbo

[out:json][bbox:50.745,7.17,50.75,7.18];
(relation[landuse];way[landuse];);
(._;>;);
out;

Then use osm2geojson.json2geojson(resopnse.json()) to produce the geojson result. After all you will find only 8 features are generated. Because some way elements are a part of a relation with "role: inner".

rapkin commented 4 years ago

I made this option, but you will receive every node as Point. So result looks like this

image image

Is it good for you?

wuzyzy commented 4 years ago

Cool, then I can filter the point or line to get polygon geometry.