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

GeoRaster2.get_window and get_tile fail for in-memory rasters #119

Open
astrojuanlu opened this issue Aug 9, 2018 · 2 comments
Open

GeoRaster2.get_window and get_tile fail for in-memory rasters #119

astrojuanlu opened this issue Aug 9, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@astrojuanlu
Copy link
Contributor

When the filename is absent, GeoRaster2.get_window and get_tile fail:

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
rs2_alt.save("/tmp/rs2_alt.tif")
tl.GeoRaster2.open("/tmp/rs2_alt.tif").get_tile(4377, 3038, 13)  # Works
@guydou
Copy link
Contributor

guydou commented Aug 13, 2018

proposed solution is to load save the in-memory raster to memory
and then use everything the same

for example:
https://github.com/satellogic/telluric/blob/reading_in_memory_raster/telluric/georaster.py#L541
and
https://github.com/satellogic/telluric/blob/reading_in_memory_raster/telluric/georaster.py#L1610

WDYT?
@Juanlu001 @arielze @drnextgis

@arielze
Copy link
Contributor

arielze commented Aug 13, 2018

in my opinion get_tile and get_window should call crop instead of the opposite way we are going today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants