banesullivan / localtileserver

🌐 dynamic tile server for visualizing rasters in Jupyter with ipyleaflet or folium
https://localtileserver.banesullivan.com
MIT License
304 stars 29 forks source link

Improve support for online COG #21

Closed giswqs closed 2 years ago

giswqs commented 2 years ago

Based on the example datasets, it seems an XML file is needed to render COG hosted online. Any guidelines on how you created the XML file? It would be awesome if a tile client can be created the same way for both local and online COG files.

Ideally, something like this:

url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif' 
tile_client = TileClient(url)

I used to rely on titiler to render online COGs. I am considering switching to localtileserver to support both local and online COGs.

https://leafmap.org/notebooks/03_cog_stac/

import leafmap
m = leafmap.Map()
url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
m.add_cog_layer(url)
m
banesullivan commented 2 years ago

Aha, so you're bringing up something that I wanted to make clear with the name. localtileserver is intended to be used only to serve tiles from raster files that exist on your local filesystem. If you want a tile server that can handle accessing remote files, you have a few options:

  1. We create a new remotetileserver package or submodule here
  2. You can use Resonant GeoData (which my team and I at Kitware have put a TON of work into handling tile serving from cloud-hosted data). See https://github.com/ResonantGeoData/ResonantGeoData/pull/603 for a demonstration.
  3. You can use GDAL's Virtual Storage Interface since we're using large_image which is simply wrapping GDAL for data access.

In your particular case, this should work because your raster is a pre-tiled Cloud Optimized GeoTiff. I have this working locally with minimal changes to localtileserver I will push the change to a PR for you to test soon

giswqs commented 2 years ago

Resonant GeoData seems awesome. I need to look into it. It would be great if you can make localtileserver work for pre-tiled COG. It might be too much work to create and maintain another package like remotetileserver.

banesullivan commented 2 years ago

It might be too much work to create and maintain another package like remotetileserver.

Well that is what Resonant GeoData is.... 😉