Closed giswqs closed 2 years ago
This feature has been implemented. See notebook example https://github.com/giswqs/leafmap/blob/master/examples/notebooks/32_local_tile.ipynb
Available in localtileserver >=0.3.14
@giswqs, I really need to add some tests to this to verify localtileserver is grabbing the right values... Need to find a sample raster with simple data/big pixels. I will look in the GDAL testing data
I just did some testing, and there are indeed some issues with the pixel values. The same image, same lon/lon with different results with Titiler endpoint and localtileserver.
import leafmap
import localtileserver
m= leafmap.Map()
url = "https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/tile_2523.tif"
m.add_cog_layer(url, bands=[4, 3, 2])
m
remote_url = "https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/tile_2523.tif"
local_url = "~/Downloads/landsat.tif"
lat = 53.404415
lon = 6.872292
leafmap.cog_pixel_value(lon, lat, url)
tile_client = localtileserver.TileClient(local_url)
leafmap.local_tile_pixel_value(lon, lat, tile_client)
The values aren't wildly different which gives me some hope that this may be a precision issue with either large_image/localtileserver or titiler.
I will try to add some tests in localtileserver to make sure everything is good there.
I will add that this is extensively tested in large_image and localtileserver simply wraps this functionality. https://github.com/girder/large_image/blob/9251babd4acaa0eecd37c4749f7d9eeac6379171/test/test_source_gdal.py#L148
But I'd still like to add some sort of user/visual test in localtileserver
Thanks to localtileserver @banesullivan https://github.com/banesullivan/localtileserver/issues/43, it is now possible to get pixel values from a local tile. This feature will improve the Inspector tool to support local tile.
https://github.com/banesullivan/localtileserver/blob/main/localtileserver/client.py#L183