tyrasd / osmtogeojson

convert osm to geojson
http://tyrasd.github.io/osmtogeojson/
MIT License
694 stars 113 forks source link

handle site relations #75

Open tyrasd opened 7 years ago

tyrasd commented 7 years ago

-> maybe render as GeometryCollection features.

related: https://github.com/tyrasd/overpass-turbo/issues/293, #42, #58

planemad commented 7 years ago

@tyrasd here is an example of a turn restriction relation represented as a GeometryCollection:

https://gist.github.com/anonymous/101194662ce0ab4bf19ce8e319fdbfd1

It looks like we could represent any relation this way perfectly as a valid geojson.

tyrasd commented 7 years ago

Yeah… But the question is if the respective OSM relations actually do represent some "geometric" feature on their own or not. For example in the case of this turn restriction: On the one hand yes, this GeometryCollection shows the OSM objects that were used to map the turn restriction, but on the other hand the turn restriction in itself is only an abstract concept about the relationship between two ways, and thus are more like properties of the two ways and one node.

Btw: Adding properties to a geometry (like here) is not actually valid GeoJSON. But I guess one could simply have the roles information stored in an array of the outer feature's properties object.

planemad commented 7 years ago

But the question is if the respective OSM relations actually do represent some "geometric" feature on their own or not.

Its not always going to make sense, but having each relation as an independent geojson feature opens up a lot of applications from using various libraries for spatial analysis or for interactivity on a map.

But I guess one could simply have the roles information stored in an array of the outer feature's properties object.

Have tried this out in this updated example

tyrasd commented 7 years ago

having each relation as an independent geojson feature opens up a lot of applications

that's a good point