I’m looking for some advice on reading/extracting planet data in a memory and time efficient manner for use in an offline map application.
I’ve been attempting to utilize Libosmium to read/assemble the ways/nodes, which I then feed into a rendering engine to display on my device. My issue is that all my tests have been using an extract (e.g. US state) and not the planet. When I attempt to use the same setup for the planet it reads forever (after 20 minutes still reading).
My primary question is what libraries/methods are most commonly used for displaying specific bbox areas of the planet for use on an offline device (e.g. RPI 5CM). I restate offline as I’ve seen many libraries/programs for extracting and saving the database data on a server, which won’t work in my case. I’ll also note I’m only interested in a handful of tags (e.g. roads, buildings).
If anyone has some experience or advice in this department, I’d most appreciate it.
use the spatial functions of the database that you want to extract information from for rendering purposes.
The guides at switch2osm.org cover this; if you wanted to do that and ignore anything in there after the “creating a database” part, and then do your own data extraction and rendering you absolutely could do that.
Extracting any area from a planet file is going to be slow as you are going to have to read through the whole thing, this is not fast on any hardware (just less slow than on a RPI 5).
The real question is how current does your data need to be (if a day old is enough you can use extracts from geofabrik abd others) and how close to “raw” OSM data (see GOL above)? And does all processing need to take place on the RPI 5?
Thanks everyone for the suggestions. I’m working on implementing GeoDesk (thanks @aighes) at the moment, it may be just what I’ve been looking for. The query based lookup is the part that, of course, I was unable to do with a regular PBF file. I basically need to extract the roads and buildings of a specific bbox (in real time) and get their node’s lon/lat (hope that answers your question @SimonPoole). From what I’m seeing so far, GeoDesk has a lot of helper functions to do this. Going to run some tests today, hopefully goes well.