diff --git a/pyproject.toml b/pyproject.toml index 4db678ad..08abb4ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,8 @@ dependencies = [ "pydantic-settings~=2.0", "pandas==1.5.3", "redis", + "fastapi>=0.100.0,<0.107.0", + "starlette<0.28", ] [project.optional-dependencies] diff --git a/titiler/xarray/factory.py b/titiler/xarray/factory.py index 95861f67..2ba9b46f 100644 --- a/titiler/xarray/factory.py +++ b/titiler/xarray/factory.py @@ -538,7 +538,7 @@ def map_viewer( "request": request, "tilejson_endpoint": tilejson_url, "tms": tms, - "resolutions": [tms._resolution(matrix) for matrix in tms], + "resolutions": [matrix.cellSize for matrix in tms], }, media_type="text/html", ) diff --git a/titiler/xarray/reader.py b/titiler/xarray/reader.py index 077a20e4..a42a2f8f 100644 --- a/titiler/xarray/reader.py +++ b/titiler/xarray/reader.py @@ -167,17 +167,17 @@ def get_variable( da = da.sel({dim_to_drop: dim_val}).drop(dim_to_drop) da = arrange_coordinates(da) - if (da.x > 180).any(): + # Make sure we have a valid CRS + crs = da.rio.crs or "epsg:4326" + da.rio.write_crs(crs, inplace=True) + + if crs == "epsg:4326" and (da.x > 180).any(): # Adjust the longitude coordinates to the -180 to 180 range da = da.assign_coords(x=(da.x + 180) % 360 - 180) # Sort the dataset by the updated longitude coordinates da = da.sortby(da.x) - # Make sure we have a valid CRS - crs = da.rio.crs or "epsg:4326" - da.rio.write_crs(crs, inplace=True) - if "time" in da.dims: if time_slice: time_as_str = time_slice.split("T")[0]