vmarc / knooppuntnet

Route planner and quality assurance for walking and cycling networks in OpenStreetMap.
MIT License
31 stars 6 forks source link

Monitor - vector tiles #369

Open vmarc opened 11 months ago

vmarc commented 11 months ago

Today, when displaying monitor maps, the details about the routes, deviations and segments are sent to the browser in geojson format. The geojson contains the coordinates of all nodes in all ways, independent of the zoom level. This is also how it works in waymarked trails when highlighting a particular route on the map. This worked very well for the routes that were originally added in the monitor. It was known from the start that with large routes being added to the monitor this would not scale very well. The amount of data that has to be sent to the browser for cross-continent routes is just too large and takes too much time. This is why for super-routes the map always just shows the information per sub-relation, and there is no map for relations only containing other relations.

Issues have been opened asking for also displaying complete super-routes (see issues #361, #356 and also to lesser extent #352). With the current technique of shipping geojson this would lead to unacceptable performance.

A solution that would scale better for large routes would be to use vector tiles instead of geojson (just like is done today for node network routes). This would allow to only ship the amount of data that is appropriate for the current zoom level (DouglasPeuckerSimplifier).

vmarc commented 11 months ago

Some initial investigation, these are more or less the number of tiles that have to be generated per zoom level:

level tile count
2 4
3 6
4 12
5 27
6 79
7 230
8 645
9 1676
10 4248
11 10253
12 23999
13 54249
14 119737
total 215165
vmarc commented 8 months ago

Some further investigation: what would it take to do hiking- and bicycle-route analysis and vector tile generation for all routes worldwide?

route type node_network other total
bicycle route 40 983 66 155 107 138
bicycle superroute 0 1 062 1 062
foot route 42 958 12 233 55 191
foot superroute 0 43 43
walking route 0 131 131
walking superroute 0 4 4
hiking route 45 371 168 382 213 753
hiking superroute 0 1 304 1 304
mtb route 30 16 898 16 928
mtb superroute 0 67 67
inline_skates route 55 166 221
inline_skates superroute 0 3 3
motorboat route 454 1 455
motorboat superroute 0 0 0
canoe route 350 287 637
canoe superroute 0 3 3

Estimated size for mongodb monitor-relations collection: 700Mb.

Time to create monitor-relations collection with 4038 relations (reading relations from overpass database one by one) remote: 1:30h, non-remote: 1:05h.

Estimated time to create all remote: 6 days!

vmarc commented 8 months ago

Additional test to create collection monitor-relations remotely, but using batches of 100 routes for the requests to the Overpass API database, estimate: 25 hours.