Skip to main content
Question

Preserving OSM node id's


mats.anderberg
Contributor
Forum|alt.badge.img+1

Hi,

I have two OSM datasets from which I derive what has changed between them with FME. I am using the OSM writer to output two datasets (what has changed and the original data). From that I use Osmosis to create a changeset to be used to update an OSM database. The problem is that the OSM writer doesn’t preserve my node id’s. This is crucial to be able to update the correct node in the database. There is no problem with the ways, the id’s I have before the writer are preserved in the osm-file. But nodes always gets id’s starting from “-1”. Here’s an example of a node list for one of the features before writing (this is the id I want to preserve in the osm-file).

Anyone else encountered this problem and have a solution? Is it by design the writer doesn’t preserve node id’s?

Thanks!

4 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+43

It might be worth sharing a basic example workspace if you have one available. That would let the community investigate a bit quicker. If we’re unable to help we would most likely direct you to Safe support for an answer. 


mats.anderberg
Contributor
Forum|alt.badge.img+1

Sure. Attaching is a simple workspace and a test osm-file to examplify the problem. The workspace is just an OSM reader and writer. The osm-file has just two nodes and a way (referencing the nodes). The id for the way is preserved in the output osm file but not the node id’s.    


virtualcitymatt
Celebrity
Forum|alt.badge.img+43

ok so I see what you mean now.

I was able to preserve the node id’s by extracting the vertices and writing them directly as node (Point) features.

This seems a little silly to me though. I guess the issue is that the nodes themselves don’t get read as features, so when going to write out the vertices from the line the coordinates don’t have any information about the node id (although it should 100% be an option to use the nd values in the list...).

In the doc there are some clues: https://docs.safe.com/fme/html/FME-Form-Documentation/FME-ReadersWriters/osm/osm.htm?Highlight=%22OSM%20node%22

“Tags on the OSM node will only be written out if there are user attributes defined on feature types and such attributes exist on the feature as attributes or point-level geometry as traits.” 

In this case the coordinates in the line do not have any properties on them. I tried to set the node id as measures, however, this didn’t work and there is no way to set geometry properties on coordinates.


mats.anderberg
Contributor
Forum|alt.badge.img+1

Yeah, that did the trick. I’ll settle on this solution for now. With this I can also add version and timestamp on the node tags (which maybe also should be an option). Thanks!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings