Skip to content
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

Support osmium locations-on-ways format #386

Merged
merged 1 commit into from
Feb 26, 2022
Merged

Support osmium locations-on-ways format #386

merged 1 commit into from
Feb 26, 2022

Conversation

systemed
Copy link
Owner

This adds support for osmium's .osm.pbf extension where files are preprocessed to add node co-ordinates to ways. The preprocessing is run like this:

osmium add-locations-to-ways great-britain-latest.osm.pbf -o great-britain-locs.osm.pbf

You can then run tilemaker in the normal way. It will notice the "LocationsOnWays" flag that osmium has inserted, and process the ways accordingly.

For tilemaker, this means that it has to read many fewer nodes into the node store. That said, in my testing so far it only makes a small difference to memory consumption - approx. 2% improvement on a GB extract. This is running in --compact mode on an already-renumbered extract, so it might make more of a difference in normal operation. I'll do some more testing and would be interested to hear anyone else's experience.

The main difference in the code is that we replace the NodeVec structure (a vector of node IDs) with a LatpLonVec (a vector of projected lat/lons). Memory usage is the same, as NodeID and LatpLon are each 64 bits.

@systemed systemed mentioned this pull request Feb 20, 2022
4 tasks
@systemed systemed merged commit ad1fcfb into master Feb 26, 2022
@systemed systemed deleted the way_locations branch February 26, 2022 16:58
@mmd-osm
Copy link

mmd-osm commented Oct 10, 2022

I have a quick question regarding the renumbering, for the proposed data model changes in osmlab/osm-data-model#20 (comment)

I presume the main memory needed to store node ids is the main concern here, right?

@systemed
Copy link
Owner Author

systemed commented Oct 11, 2022

Essentially there are two reasons for renumbering in a situation like this:

  • reducing the ID space (e.g. being able to use 32-bit IDs rather than 64-bit IDs)
  • using contiguous storage (vector/array/list) rather than non-contiguous (typically hash/map/dictionary, but also possibly sparse array), which saves both memory and processing time

They're particularly relevant when using an extract of OSM data rather than the full planet.

FWIW I'm happy with the existing tooling around both renumbering and adding locations to ways, and don't see a massive need to change the OSM data model here - essentially the model is a storage and transport format, and a little bit of processing should be expected. If I had one tilemaker-related 'ask' for 0.7, it would be "sort out multipolygons" ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants