Urban-Analytics-Technology-Platform / od2net

https://od2net.org
Apache License 2.0
31 stars 9 forks source link

Create pmtiles directly #41

Closed dabreegster closed 10 months ago

dabreegster commented 11 months ago

This is an experiment to generate pmtiles directly in Rust, not using tippecanoe. It's specialized for the use case in od2net -- a bunch of tiny LineStrings representing segments of the road network. The "importance" of the roads is given by a count property in the GeoJSON data, so this should be used to figure out which features to drop at low zooms.

CC @stuartlynn

"Correctness" to use in the od2net viewer:

Performance of the tool itself:

Logistic:

stuartlynn commented 11 months ago

Hey I am going to try and take a swing at doing bbox filtering using rstar. I have used it on some projects before with good results.

dabreegster commented 11 months ago

Yes please! Maybe I don't understand coordinate systems well enough, but can this be done with WGS84, or do we have to project to Web Mercator or something else first?

(I won't pick this up until Monday again, no fear of merge conflicts)

stuartlynn commented 11 months ago

I think given that we need to convert to WebMercator anyway to generate the tiles, it makes sense to

  1. Load the features
  2. Transform to WebMercator
  3. Build the RTree
  4. Iterate through the tiles and use the RTree to select the features for each
  5. Generate the tile
  6. Add it to PMTiles.

One thing that might be interesting to experiment with is generating the tiles in parallel (with rayon) and storing them somewhere intermediary before constructing the full pm tiles at the end? That's an enhancement though

dabreegster commented 11 months ago

@stuartlynn , there's some chatter in the georust discord about possible distance metrics that could be useful: https://discord.com/channels/598002550221963289/963346313708195880/1167857249977372733

stuartlynn commented 11 months ago

@stuartlynn , there's some chatter in the georust discord about possible distance metrics that could be useful: https://discord.com/channels/598002550221963289/963346313708195880/1167857249977372733

Not sure that link is working for me. What were you thinking if using the different distance metrics for?

dabreegster commented 11 months ago

Hmm, try joining https://discord.gg/Fp2aape and checking #random around 10/28. Someone pointed out https://github.com/vipera/cheap-ruler-rs. I think web merctor + rstar makes sense to me though.

dabreegster commented 10 months ago

Moved to https://github.com/Urban-Analytics-Technology-Platform/lines2pmtiles