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

Script to generate GeoTIFF from ZXY tile server #811

merged 3 commits into from Aug 15, 2019


Copy link

commented Aug 6, 2019

This PR adds a script to generate a GeoTIFF from a ZXY tile server URI schema, bounds in lng/lat format, and a zoom level. It correctly crops the image based on the bounds, and also works on TMS format tile servers. This lays the groundwork for a ZXYRasterSource and may be independently useful.

It is tested with unit tests, and I also ran it on an example. I created a tile set from a GeoTIFF using gdal2tiles, got some bounds in QGIS, ran the script, and checked that the output was correct.

root@70d4aadebe15:/opt/src# python -m "/opt/data/hippo-tiles/{z}/{x}/{-y}.png" 17 \
>     "39.950380846608667 -75.163183288636375 39.951604868181825 -75.158675638636367" \
>     /opt/data/hippo-tiles/out.tif




This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2019

Note: tiles in example were created using

conda install gdal
pip install gdal2tiles /opt/data/hippos.tif -z 17 /opt/data/hippo-tiles

in the fastai Docker image. (there was trouble installing it in the main RV image)

@@ -0,0 +1,182 @@
import tempfile

This comment has been minimized.

Copy link

lossyrob Aug 6, 2019


I understand why this is here (it'll be used by a raster source), but I think this would be more discoverable if it was moved to the rastervision.utils package. I can see these methods being imported as a utility by other code that just wants to grab geotiffs from zxy endpoints.

@lewfish lewfish force-pushed the lf/zxy branch from 00f95f7 to 1aacb90 Aug 7, 2019

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2019

I updated according to your suggestion and added a --make-cog option using your code.

@lewfish lewfish force-pushed the lf/zxy branch from 1aacb90 to cc8a537 Aug 15, 2019
@lewfish lewfish merged commit ab4f016 into master Aug 15, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@lewfish lewfish deleted the lf/zxy branch Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.