Urban-Analytics-Technology-Platform / od2net

https://od2net.org
Apache License 2.0
28 stars 6 forks source link

Using RTree to select features for tiles #42

Closed stuartlynn closed 10 months ago

stuartlynn commented 10 months ago

This PR

I think it basically works, there are a few potential optimizations

  1. Currently we are iterating over all possible tiles in each zoom level. It should be able to exclude ranges of tiles based on the bbox of the lowest level envelope in the RTree
  2. There is a copy in the conversion of geo_json::Feature to TreeFeature which I think can be removed
  3. We should be able to exclude the child tiles of an empty tile from processing. If a level 2 tile is empty then it's descendants will be too. This might be a marginal speed up though as the RTree should already catch this
stuartlynn commented 10 months ago

This is awesome, thanks! For a real input from Edinburgh, it takes the total time from 35s down to 30s. And after the CachedEnvelope, down to 27s. Happy to merge this and keep iterating on ideas for pruning which tiles to calculate

Are those timings using release?

dabreegster commented 10 months ago

Are those timings using release?

Yes. time cargo run --release ../examples/edinburgh/output/output.geojson (after building -- this doesn't include compilation). I can send over that GJ input, or you can generate it by cd examples/edinburgh; python3 setup.py; cargo run --release config.json