Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get elevation data from a pure Rust crate that only handles some #1134

Merged
merged 2 commits into from
Jan 1, 2024

Conversation

dabreegster
Copy link
Collaborator

GeoTIFFs. #82

This PR switches from Docker + Python/GDAL-based https://github.com/eldang/elevation_lookups to pure Rust https://github.com/dabreegster/elevation. The benefits are:

  • Portability. In the span of a year or two, the Docker + GDAL based environment broke on newer Ubuntu, making it a chore just to re-run. Pure Rust means everything compiles anywhere with no external dependencies.
  • Simplicity. The code is just bilinear interpolation on top of https://github.com/pka/georaster/. The simplifying assumption that removes the need for GDAL is that the input is a GeoTIFF in EPSG:4326. gdalwarp -t_srs EPSG:4326 kc_2016_lidar.tif king_county_2016_lidar.tif as a one-time step is all it takes to transform the Seattle file, and the UK one was already in the right coordinate system.
  • Speed. The South Seattle elevation step drops from 4.2s to 1.67s.

A future step could look for SRTM / NASADEM geotiff files and do any coordinate transformation necessary for use anywhere. And separately, use a pure Rust approach for interpolating from GeoJSON contour files.

Validation was regenerating Seattle and UK maps and checking the elevation / steep street layers in the simulation mode. The results are not exactly the same, but close enough. Regenerating all maps again now, will merge when that's done.

@dabreegster
Copy link
Collaborator Author

Edit: between this and yesterday's switch to osm.pbf for imports, I can regenerate all 156 cities on my fastest laptop in about 15 minutes! I don't quite remember what it was before, but I'm quite sure this is a nice improvement

@dabreegster dabreegster merged commit 8eb491e into main Jan 1, 2024
1 check passed
@dabreegster dabreegster deleted the elevation branch January 1, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant