Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/developmentseed/titiler int…
Browse files Browse the repository at this point in the history
…o 0.12Upgrade
  • Loading branch information
vincentsarago committed Jul 17, 2023
2 parents 1306e23 + bc3fd14 commit 11c9cd6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
7 changes: 4 additions & 3 deletions docs/src/advanced/Extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ See [titiler.application](../application) for a full example.
from dataclasses import dataclass, field
from typing import Tuple, List, Optional

import rasterio
from starlette.responses import Response
from fastapi import Depends, FastAPI, Query
from titiler.core.factory import BaseTilerFactory, FactoryExtension, TilerFactory
Expand Down Expand Up @@ -140,8 +141,8 @@ class thumbnailExtension(FactoryExtension):
env=Depends(factory.environment_dependency),
):
with rasterio.Env(**env):
with self.reader(src_path, **reader_params) as src_dst:
im = src.preview(
with factory.reader(src_path, **reader_params) as src:
image = src.preview(
max_size=self.max_size,
**layer_params,
**dataset_params,
Expand All @@ -160,7 +161,7 @@ class thumbnailExtension(FactoryExtension):

content = image.render(
img_format=format.driver,
colormap=colormap or dst_colormap,
colormap=colormap,
**format.profile,
**render_params,
)
Expand Down
18 changes: 9 additions & 9 deletions docs/src/endpoints/cog.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The `/cog` routes are based on `titiler.core.factory.TilerFactory` but with `cog
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **nodata** (str, int, float): Overwrite internal Nodata value.
- **unscale** (bool): Apply dataset internal Scale/Offset.
- **resampling** (str): rasterio resampling method. Default is `nearest`.
Expand Down Expand Up @@ -73,7 +73,7 @@ Example:
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **max_size** (int): Max image size, default is 1024.
- **height** (int): Force output image height.
- **width** (int): Force output image width.
Expand Down Expand Up @@ -112,7 +112,7 @@ Example:
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`.
- **max_size** (int): Max image size, default is 1024.
- **nodata** (str, int, float): Overwrite internal Nodata value.
Expand Down Expand Up @@ -148,7 +148,7 @@ Example:
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`.
- **max_size** (int): Max image size, default is 1024.
- **nodata** (str, int, float): Overwrite internal Nodata value.
Expand Down Expand Up @@ -183,7 +183,7 @@ Note: if `height` and `width` are provided `max_size` will be ignored.
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`.
- **nodata** (str, int, float): Overwrite internal Nodata value.
- **unscale** (bool): Apply dataset internal Scale/Offset.
Expand All @@ -208,7 +208,7 @@ Example:
- **minzoom** (int): Overwrite default minzoom.
- **maxzoom** (int): Overwrite default maxzoom.
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **nodata** (str, int, float): Overwrite internal Nodata value.
- **unscale** (bool): Apply dataset internal Scale/Offset.
- **resampling** (str): rasterio resampling method. Default is `nearest`.
Expand Down Expand Up @@ -242,7 +242,7 @@ Example:
- **minzoom** (int): Overwrite default minzoom.
- **maxzoom** (int): Overwrite default maxzoom.
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **nodata** (str, int, float): Overwrite internal Nodata value.
- **unscale** (bool): Apply dataset internal Scale/Offset.
- **resampling** (str): rasterio resampling method. Default is `nearest`.
Expand Down Expand Up @@ -297,7 +297,7 @@ Advanced raster statistics
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **max_size** (int): Max image size from which to calculate statistics, default is 1024.
- **height** (int): Force image height from which to calculate statistics.
- **width** (int): Force image width from which to calculate statistics.
Expand All @@ -322,7 +322,7 @@ Example:
- QueryParams:
- **url** (str): Cloud Optimized GeoTIFF URL. **Required**
- **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`).
- **expression** (str): rio-tiler's band math expression (e.g B1/B2).
- **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`).
- **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`.
- **max_size** (int): Max image size from which to calculate statistics, default is 1024.
- **height** (int): Force image height from which to calculate statistics.
Expand Down
14 changes: 7 additions & 7 deletions src/titiler/extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class thumbnailExtension(FactoryExtension):
env=Depends(factory.environment_dependency),
):
with rasterio.Env(**env):
with self.reader(src_path, **reader_params) as src_dst:
im = src.preview(
max_size=self.max_size,
**layer_params,
**dataset_params,
)
with factory.reader(src_path, **reader_params) as src:
image = src.preview(
max_size=self.max_size,
**layer_params,
**dataset_params,
)

if post_process:
image = post_process(image)
Expand All @@ -138,7 +138,7 @@ class thumbnailExtension(FactoryExtension):

content = image.render(
img_format=format.driver,
colormap=colormap or dst_colormap,
colormap=colormap,
**format.profile,
**render_params,
)
Expand Down

0 comments on commit 11c9cd6

Please sign in to comment.