telluric icon indicating copy to clipboard operation
telluric copied to clipboard

Get_tile should return a raster which is projected to web_mercator

Open guydou opened this issue 6 years ago • 5 comments

guydou avatar Aug 07 '18 12:08 guydou

While investigating this issue I noticed another thing:

screenshot_2018-08-08 _issue_get-tile-mercator

I get the same result regardless of the masked and resampling. Is this to be expected?

astrojuanlu avatar Aug 08 '18 11:08 astrojuanlu

Also, GeoRaster2.get_tile (internally GeoRaster2.get_window) fails for in-memory rasters:

from rasterio.enums import Resampling

import telluric as tl
from telluric.constants import *

rs1 = tl.GeoRaster2.open("../tests/data/raster/overlap1.tif", lazy_load=False)
rs2 = tl.GeoRaster2.open("../tests/data/raster/overlap2.tif", lazy_load=False) 

rs2_alt = (
    rs2
    .reproject(dst_crs=WGS84_CRS, resampling=Resampling.nearest)
    .reproject(dst_crs=WEB_MERCATOR_CRS, resampling=Resampling.nearest)
)

rs2.get_tile(4377, 3038, 13)  # Works
rs2_alt.get_tile(4377, 3038, 13)  # Fails

astrojuanlu avatar Aug 08 '18 11:08 astrojuanlu

Confirmed original issue:

rs2_4326.save("/tmp/rs2_4326.tif")

tl.GeoRaster2.open("/tmp/rs2_4326.tif").get_tile(4377, 3038, 13)  # Empty image

astrojuanlu avatar Aug 08 '18 11:08 astrojuanlu

I think you should open on each of the issues here an issue of its own,

about the mask, the mask will not have an effect on a raster that nodata value set, the paramter tells rasterio not to read the mask from the raster, we are doing it, because when you have no-data value set up rasterio is not using the overview masks

guydou avatar Aug 09 '18 06:08 guydou

I think you should open on each of the issues here an issue of its own

Done: #118 and #119

astrojuanlu avatar Aug 09 '18 07:08 astrojuanlu