How to create geometry from relation?
See original GitHub issueI tried to get geometries from relations but I was getting ArgumentError
for both .create_linestring()
and .create_multipolygon()
. I also tried both methods for each r.member
element but with the same error. Both area
and way
geometries are working. Here is a snippet of my code:
import osmium as osm
import shapely.wkb
wkb_factory = osm.geom.WKBFactory()
class OSMHandler(osm.SimpleHandler):
def __init__(self):
osm.SimpleHandler.__init__(self)
self.amenities = []
def relation(self, r):
if 'amenity' in r.tags:
wkb = wkb_factory.create_linestring(r)
multipolygon = shapely.wkb.loads(wkb, hex=True)
lon, lat = line.centroid.x, line.centroid.y
self.amenities.append([r.id, r.tags['amenity'], lon, lat])
handler = OSMHandler()
handler.apply_file('liechtenstein-latest.osm.pbf', locations=True)
ArgumentError: Python argument types in
WKBFactory.create_multipolygon(WKBFactory, Relation)
did not match C++ signature:
create_multipolygon(WKBFactory {lvalue} self, osmium::Area area)
Is there a proper way to get the geometry from a relation in pyosmium? Thank you in advance.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
4.15 Geometric Relationships | Geometry for Modeling and ...
This excerpt from Technical Drawing with Engineering Graphics shows how to identify and specify basic geometric elements and shapes.
Read more >Geometric (Sketch) Relations – Introduction to SolidWorks Part 1
Geometric relations are added by activating the “ Add Relation ” command in the Sketch tab of the CommandManager (Figure 2.28). You can...
Read more >Geometric Relations - 2020 - SOLIDWORKS Help
(Dimensions/Relations toolbar) or Tools > Relations > Add to create geometric relations (such as tangent or perpendicular) between sketch entities, ...
Read more >Create, Construct, and Query geometry Instances - SQL Server
The geometry data type provides many built-in methods you can use to determine relationships between two geometry instances. To determine if two ...
Read more >Finding geometries with spatial relationships—ArcMap
The Geometry on Geometry check allows you to find features that are spatially ... spatial relationship, the check will create results with point...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@njanakiev Did you find a way to solve your problem ? I need the same to build a multi-linestring from relation
Thank you for clarification, @lonvia