@joto 

I think I have a question that relates to the issue @cdauth is struggling with.

What I attempted to do is to build a table with geometries from waterway 
relations in OpenStreetMap.

Now I use the **object.as_geometrycollection()** function to generate a 
geometry collection object of e.g. the Alpine Rhine waterway relation 
(https://www.openstreetmap.org/relation/21222156), and subsequently insert each 
of its member ways into a table using either **geom:geometries()** or 
**geom.geometry_n()** and looping over the members.

According to the documentation, object.as_geometrycollection()

>  It will contain all geometries which can be generated from node and way 
> members of the relation in **order of those members**.

will return the members in the order as defined in the relation, if I 
understand well.

However, if I e.g. want to know the osm ID of the n-th member way, I cannot use 
the **object.members**. I would have expected object.members to return the 
members of the relation _**in order of those members****_ as well. However, if 
I attempt to grab e.g. the n-th geometry of the geometry collection using 
**geom.geometry_n(n)** and also try to grab the n-th member as returned by 
**object.members** by using **object.members[n]** and subsequently retrieve the 
osm ID by using the **ref** field of the member table, I get back an osm ID 
that does not correspond with the n-th way member of the relation, but another 
osm ID. So it seems that the geometry collection, and the **object.members** 
Lua table are out of sync, and **object.members** not sorted by the order in 
which the relation members are stored in the relation.

Note that the relations I noticed this on, like the Alpine Rhine, do not 
contain any sub-relations, just way members, and no nodes. So I would expect it 
would be possible to have the geometry collections members and 
**object.members** to be in sync.

Of course, it would be nice if I could somehow grab the geometry from the Lua 
member table, similar to type,ref,role, e.g. **member_table.geometry**, similar 
to **member_table.type/ref/role**, so that the it would be guaranteed to be in 
sync.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2204#discussioncomment-18270018
You are receiving this because you are subscribed to this thread.

Message ID: 
<osm2pgsql-dev/osm2pgsql/repo-discussions/2204/comments/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to