osmtogeojson
osmtogeojson copied to clipboard
Relations with members are not included if a member is one of the features in the OSM source file
Here's a gist with a minimal test case: https://gist.github.com/mnquintana/2d7009ea406b6377269a?short_path=87290a1
- I have a relation with two members, each of which is a way
- OSM export includes both members and the relation that contains them
Expected
After parsing with osmtogeojson, there will be 3 features - two ways, and a relation.
Actual
After parsing with osmtogeojson (for the purposes of this example, done via overpass-turbo), there are only two features, each of which is associated with the relation, but the relation is not included as a feature.
This is a bit of a delicate issue: osmtogeojson tries to produce output for all OSM data that has a direct representation as a 2-dimensional (GeoJSON) geometry on their own. Abstract/generic/complex relation types such as turn restrictions, site relations, etc. don't usually have their own geometry (different to multipolyons for example), thus they are only present via their members. A bit of a corner case are route relations which are presently not converted to their own geometries, but I'm still thinking about implementing it (see #1).
How would you have expected the result for relations as in your example to look like? A GeometryCollection of all it's members' geometries? What's the context/use case here? Do you intend to use osmtogeojson as a library or command line tool?
How would you have expected the result for relations as in your example to look like? A GeometryCollection of all it's members' geometries?
Pretty much, yeah. I'd want the exported relation to have "copy" of all its members' geometries - that way, I can use the relation without having to reference member geometries.
What's the context/use case here?
In this particular case, I need this for a building that actually consists of multiple distinct buildings. I can't reference multiple geometries in my particular case - I can only reference one, so I'd need to use the relation.
Do you intend to use osmtogeojson as a library or command line tool?
Right now I'm using it as a library.
Regarding ghe GeometryCollection, I'd rather offer different options. I'd be happy with relations being expressed as properties of the involved members, but having a geometry may be interesting too.