Reducing file size for flexible mode


I’m trying to optimize the size of the generated files for my offline maps. Since I want to use them for my offline app on mobile devices, the size of them is a critical matter here.

I did some tests using CH only, and now with LM only (I guess LM means flexible). And the size is a bit bigger for the LM (not much more though). However, I find them a bit bigger than I wished, and I though that there might be some configuration I’m missing that could make this to be improved.

My current configuration is this one:

graph.elevation.provider: multi
graph.elevation.calc_mean: true
graph.elevation.smoothing: true “no” // This is to disable CH mode, since it increases the size of the generated files if I generate the grahps with CH and LM modes enabled, plus I want the alternative_route algorithm to be used, and that requires the LM mode

prepare.lm.weightings: fastest
prepare.lm.landmarks: 16

routing.max_visited_nodes: 1000000

My main question is how could I reduce the size of the generated files?

A secondary question is what is this for? prepare.lm.landmarks: 16

I have been reading this article and it seems that the higher the number of landmarks, the fastest the LM mode is on the device. Although this obviously increases the file size of the generated files. However, what is a great value for prepare.lm.landmarks parameter? My maps aren’t that big, they are regions of countries (Catalonia, Andalusia…in Spain, or Occitania in France, for example).

My tests on my smartphone have shown a great time for calculating the route with prepare.lm.landmarks: 16 for routes that are shorter than 50-75km (less than 2 seconds) for hike vehicle (the only vehicle I’m interested in). If I increase the distance, the performance decreases to 2-4 seconds or even more for 150-200km route length.

Size clearly decreases as I decrease the number of landmarks, and it increases if I increase it.

Doubling to 32, doubles the size of landmarks_fastest_hike file.

Cutting in half to 8, reduces it to 50% of the size.

Speed doesn’t seem to be affected so much. (haven’t performed tests, it’s only my appreciation of the time it takes).

1 Like

After reading the main README file of the github project, I can see that using LM is actually called hybrid mode. That would make sense, since it creates some files for it (so there is some work done in advance and will make quicker than using the non-optimized flexible mode).

1 Like

It should, especially for longer routes, but have only tested on server/laptop not mobile device. You can also tweak the active landmarks used in one request.

Under your experience, what would you say that’s a great value for prepare.lm.landmarks related to OSM.PBF files of 100-500MB?

You’ll have to benchmark this, depends on too many things. The defaults should work for many use cases.