Mapping relation nodes or way nodes to lat/lon coordinates?

The goal is to construct a data structure that takes the id of a node/way/relation and returns the pair of lat/lon or the collection of lat/lon coordinates assigned to it. So far, I have downloaded the osm file of my city, gotten rid of superfluous nodes like those pointing to amenities, and then used osmconvert with the all-to-nodes feature to construct a csv file that contains the columns @Id@name@lat@lon. This approach does work to construct a look up system for id(of node)->lat/lon. But not for id(of relation/way)–> List of lat/lons. Does anybody know if there is a osmconvert feature or another way to retrieve this kind of list or csv file.

With all-to-nodes, you destroyed the very data you sought.

Nodes are look-up tables of attribute and value pairs, two attributes are latitude and longitude.

Paths are ordered lists of nodes which are either open (way) or closed (polygon) paths with associated look-up tables of attribute and value pairs.

Multi-polygons are polygons with attributes that describe how the polygons nest among other data.

Relations are lists of paths (in the senses above) and nodes with look-up tables of attribute and value pairs to explain the association.

You have a multiple level lookup to do; e.g., look up a relation and get its list of components, then look up each path to get its list of nodes and include the stand alone nodes in the relation and then look up the nodes to get the latitude and longitudes.

Depending on the amount of such look ups you need to do, just a few per day and you could use Overpass Turbo to do these look ups and you have hundreds or more per day clone the OSM data base for the area and query that.

A CSV spread sheet is just a tiny example of a database.

Duplicate post: