From c13cf41058c16d29c8d1b6af0423f4ef231135ee Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Tue, 22 Oct 2024 08:57:23 +0200 Subject: [PATCH] update docs --- docs/src/advanced/dynamic.md | 1 - .../Create_a_Dynamic_RtreeBackend.ipynb | 21 +++++++++---------- .../Create_a_Dynamic_StacBackend.ipynb | 1 - docs/src/intro.md | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/src/advanced/dynamic.md b/docs/src/advanced/dynamic.md index b15652ac..1f553150 100644 --- a/docs/src/advanced/dynamic.md +++ b/docs/src/advanced/dynamic.md @@ -63,7 +63,6 @@ class DynamicStacBackend(BaseBackend): default=(-180, -90, 180, 90) ) crs: CRS = attr.ib(default=WGS84_CRS) - geographic_crs: CRS = attr.ib(default=WGS84_CRS) # STAC API related options # max_items | next_link_key | limit diff --git a/docs/src/examples/Create_a_Dynamic_RtreeBackend.ipynb b/docs/src/examples/Create_a_Dynamic_RtreeBackend.ipynb index 17ce46d4..29471e75 100644 --- a/docs/src/examples/Create_a_Dynamic_RtreeBackend.ipynb +++ b/docs/src/examples/Create_a_Dynamic_RtreeBackend.ipynb @@ -93,7 +93,7 @@ "with httpx.stream(\"GET\", url) as r:\n", " r.raise_for_status()\n", " with open(\"tiles.p\", \"wb\") as f:\n", - " for chunk in r.iter_bytes(chunk_size=8192): \n", + " for chunk in r.iter_bytes(chunk_size=8192):\n", " f.write(chunk)\n", "\n", "# Load tile index and create rtree index\n", @@ -162,15 +162,15 @@ "class DynamicRtreeBackend(BaseBackend):\n", "\n", " asset_filter: Callable = attr.ib(default=lambda x: x)\n", - " \n", + "\n", " # The reader is read-only, we can't pass mosaic_def to the init method\n", " mosaic_def: MosaicJSON = attr.ib(init=False)\n", "\n", " index = attr.ib(init=False)\n", - " \n", + "\n", " tms: morecantile.TileMatrixSet = attr.ib(default=WEB_MERCATOR_TMS)\n", - " minzoom: int = attr.ib(default=12) # we know this by analysing the NAIP data \n", - " maxzoom: int = attr.ib(default=17) # we know this by analysing the NAIP data \n", + " minzoom: int = attr.ib(default=12) # we know this by analysing the NAIP data\n", + " maxzoom: int = attr.ib(default=17) # we know this by analysing the NAIP data\n", "\n", " _backend_name = \"DynamicSTAC\"\n", "\n", @@ -190,7 +190,6 @@ " self.index = index.Index(self.input)\n", " self.bounds = tuple(self.index.bounds)\n", " self.crs = self.tms.rasterio_geographic_crs\n", - " self.geographic_crs = self.tms.rasterio_geographic_crs\n", "\n", " def close(self):\n", " \"\"\"Close SQLite connection.\"\"\"\n", @@ -198,8 +197,8 @@ "\n", " def __exit__(self, exc_type, exc_value, traceback):\n", " \"\"\"Support using with Context Managers.\"\"\"\n", - " self.close() \n", - " \n", + " self.close()\n", + "\n", " def write(self, overwrite: bool = True):\n", " \"\"\"This method is not used but is required by the abstract class.\"\"\"\n", " pass\n", @@ -274,14 +273,14 @@ "import pathlib\n", "\n", "def latest_naip_asset(assets: List[str]) -> List[str]:\n", - " \n", + "\n", " def get_info(asset) -> Dict:\n", " parts = pathlib.Path(asset).parts\n", " capture_date = parts[-1].split(\"_\")[-1].rstrip(\".tif\")\n", " resolution = int(parts[-3].split(\"_\")[1].rstrip(\"cm\"))\n", " fname_parts = parts[-1].split(\"_\")\n", " quadrangle = f\"{fname_parts[1]}_{fname_parts[2]}_{fname_parts[3]}\"\n", - " \n", + "\n", " return {\n", " \"path\": asset,\n", " \"capture_date\": capture_date,\n", @@ -290,7 +289,7 @@ " }\n", "\n", " asset_info = [get_info(f) for f in assets]\n", - " \n", + "\n", " # Sort by resolution and by dates\n", " asset_info = sorted(\n", " asset_info, key=lambda item: (item[\"capture_date\"], -item[\"resolution\"]),\n", diff --git a/docs/src/examples/Create_a_Dynamic_StacBackend.ipynb b/docs/src/examples/Create_a_Dynamic_StacBackend.ipynb index 0465d607..63815cf4 100644 --- a/docs/src/examples/Create_a_Dynamic_StacBackend.ipynb +++ b/docs/src/examples/Create_a_Dynamic_StacBackend.ipynb @@ -74,7 +74,6 @@ " default=(-180, -90, 180, 90)\n", " )\n", " crs: CRS = attr.ib(default=WGS84_CRS)\n", - " geographic_crs: CRS = attr.ib(default=WGS84_CRS)\n", "\n", " # STAC API related options\n", " # max_items | next_link_key | limit\n", diff --git a/docs/src/intro.md b/docs/src/intro.md index 8c642d8a..af5cf3a0 100644 --- a/docs/src/intro.md +++ b/docs/src/intro.md @@ -71,10 +71,8 @@ with S3Backend("s3://mybucket/amosaic.json") as mosaic: mosaic.maxzoom # attribute - Mosaic (default to tms or mosaic maxzoom) mosaic.crs # property - CRS (from mosaic's TMS geographic CRS) - mosaic.geographic_crs # property - CRS (from mosaic's TMS geographic CRS) mosaic.bounds # property - Mosaic bounds in `mosaic.crs` mosaic.center # property - Mosaic center (lon, lat, minzoom) - mosaic.geographic_bounds # property - Mosaic bounds in `mosaic.geographic_crs` mosaic.mosaicid # property - Return sha224 id from the mosaicjson doc mosaic.quadkey_zoom # property - Return Quadkey zoom of the mosaic @@ -84,6 +82,8 @@ with S3Backend("s3://mybucket/amosaic.json") as mosaic: mosaic.info(quadkeys=True/False) # method - spatial_info, list of quadkeys and mosaic name + mosaic.get_geographic_bounds(crs: CRS) # method - Return mosaic bounds in a geographic CRS + mosaic.assets_for_tile(x, y, z) # method - Find assets for a specific mercator tile mosaic.assets_for_point(lng, lat) # method - Find assets for a specific point mosaic.assets_for_bbox(xmin, ymin, xmax, ymax) # method - Find assets for a specific bbox