-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create geometry from relation? #80
Comments
Relations as is do not have geometries. This is something that you can infer from tags. This is done for you in osmium so for relations that are multipolygons you will get an area and that what works for you. As I understand - you would also like to have similar support for relations that represent line objects (such as routes). As far as I'm familiar with pyosmium and osmium, this is not implemented yet. |
Thank you, @wiktorn. This means that the geometries of relations that are not tagged with Yes, I think it would be useful to be able to get the geometry from a relation as a multi polygon or multiline string. But I suppose that issue exists for osmium already? |
You can get multi-polygons for all non-broken relations tagged type=multipolygon or type=boundary. Use the area() callback instead of the relation() callback. Be aware though, that this also returns closed ways (i.e. it returns everything that represents an area in OSM)). There is no way to return multi-linestrings from relation. This is covered as a feature request in #50 already. |
Thank you for clarification, @lonvia |
@njanakiev Did you find a way to solve your problem ? I need the same to build a multi-linestring from relation |
I wrote an example which shows how you can get shapely polygons from relations. It is a bit clunky, but I had to do it this way, because I have a history file which is not compatible with the |
I tried to get geometries from relations but I was getting
ArgumentError
for both.create_linestring()
and.create_multipolygon()
. I also tried both methods for eachr.member
element but with the same error. Botharea
andway
geometries are working. Here is a snippet of my code:Is there a proper way to get the geometry from a relation in pyosmium? Thank you in advance.
The text was updated successfully, but these errors were encountered: