I have a Geotiff that I display on a tile map, but it’s slightly off to the south. For example on this screenshot the edge of the image should be where the country border is, but it’s a bit to the south. (I can only embed 1 image so I included the sceenshots fo the rest of the post too)
Here’s the relevant part of the code:
tiff_rio_500 = rioxarray.open_rasterio( '/content/mw/mw_dist_to_light_at_all_from_light_mask_mw_cut_s3_500.tif' )
dataarray_500 = tiff_rio_500[0]
dataarray_500_meters = dataarray_500.copy()
dataarray_500_meters['x'], dataarray_500_meters['y'] = ds.utils.lnglat_to_meters(dataarray_500.x, dataarray_500.y)
hv_dataset_500_meters = hv.Dataset(dataarray_500_meters, name='nightlights', vdims='cumulative_cost')
hv_tiles_osm_bokeh = hv.element.tiles.OSM().opts(width=1000, height=800)
hv_image_500_meters_bokeh = hv.Image(hv_dataset_500_meters, kdims=['x', 'y'], vdims=['cumulative_cost'], rtol=1).opts(cmap='inferno_r')
hv_combined_osm_500_meters_bokeh = hv_tiles_osm_bokeh * hv_image_500_meters_bokeh
hv_combined_osm_500_meters_bokeh
You can see the live notebook on google colab.
Now this is not the usual “everything is way off” problem that occurs when one doesn’t convert the map to Web Mercator. It is almost perfect, it just isn’t.
The Geotiff is an Earth Engine export. You an see above how it looked originally in Earth Engine (or see live code).
As you can see, the image follows the borders everywhere.
At first I suspected that maybe the export went wrong, or the google map tileset is somewhat different, but no, if I open the same exported Tiff in the QGis application on my windows laptop and view it over the same OSM tilemap as I do in the colab notebook, it looks fine, see again above, part 3 of the screenshot.
Okay, the image does not follow the borders perfectly, but I know why and that’s unrelated (I oversimplified the country border geometry). The point is, that it is projected to the correct location. So based on that, the tiff contains correct information, it can be displayed at the same location as the borders are in the OSM tilemap, but still in my Holoviews-Datashader-Bokeh project it is slightly off.
Any idea why this happens?