Skip to content

Commit

Permalink
Update the titiler endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Sep 7, 2023
1 parent f4ba02f commit 635af29
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
34 changes: 17 additions & 17 deletions eefolium/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,13 +2351,13 @@ def load_GeoTIFFs(URLs):
return ee.ImageCollection(collection)


def get_COG_tile(url, titiler_endpoint="https://api.cogeo.xyz/", **kwargs):
def get_COG_tile(url, titiler_endpoint="https://titiler.xyz/", **kwargs):
"""Get a tile layer from a Cloud Optimized GeoTIFF (COG).
Source code adapted from https://developmentseed.org/titiler/examples/Working_with_CloudOptimizedGeoTIFF_simple/
Args:
url (str): HTTP URL to a COG, e.g., https://opendata.digitalglobe.com/events/mauritius-oil-spill/post-event/2020-08-12/105001001F1B5B00/105001001F1B5B00.tif
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
tuple: Returns the COG Tile layer URL and bounds.
Expand Down Expand Up @@ -2386,7 +2386,7 @@ def get_COG_tile(url, titiler_endpoint="https://api.cogeo.xyz/", **kwargs):
return r["tiles"][0]


def get_COG_mosaic(links, titiler_endpoint="https://api.cogeo.xyz/", username='anonymous', layername=None, overwrite=False, verbose=True, **kwargs):
def get_COG_mosaic(links, titiler_endpoint="https://titiler.xyz/", username='anonymous', layername=None, overwrite=False, verbose=True, **kwargs):

import requests

Expand Down Expand Up @@ -2432,12 +2432,12 @@ def get_COG_mosaic(links, titiler_endpoint="https://api.cogeo.xyz/", username='a
print(e)


def get_COG_bounds(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_COG_bounds(url, titiler_endpoint="https://titiler.xyz/"):
"""Get the bounding box of a Cloud Optimized GeoTIFF (COG).
Args:
url (str): HTTP URL to a COG, e.g., https://opendata.digitalglobe.com/events/mauritius-oil-spill/post-event/2020-08-12/105001001F1B5B00/105001001F1B5B00.tif
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
list: A list of values representing [left, bottom, right, top]
Expand All @@ -2455,12 +2455,12 @@ def get_COG_bounds(url, titiler_endpoint="https://api.cogeo.xyz/"):
return bounds


def get_COG_center(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_COG_center(url, titiler_endpoint="https://titiler.xyz/"):
"""Get the centroid of a Cloud Optimized GeoTIFF (COG).
Args:
url (str): HTTP URL to a COG, e.g., https://opendata.digitalglobe.com/events/mauritius-oil-spill/post-event/2020-08-12/105001001F1B5B00/105001001F1B5B00.tif
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
tuple: A tuple representing (longitude, latitude)
Expand All @@ -2470,12 +2470,12 @@ def get_COG_center(url, titiler_endpoint="https://api.cogeo.xyz/"):
return center


def get_COG_bands(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_COG_bands(url, titiler_endpoint="https://titiler.xyz/"):
"""Get band names of a Cloud Optimized GeoTIFF (COG).
Args:
url (str): HTTP URL to a COG, e.g., https://opendata.digitalglobe.com/events/mauritius-oil-spill/post-event/2020-08-12/105001001F1B5B00/105001001F1B5B00.tif
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
list: A list of band names
Expand All @@ -2493,12 +2493,12 @@ def get_COG_bands(url, titiler_endpoint="https://api.cogeo.xyz/"):
return bands


def get_STAC_tile(url, bands=None, titiler_endpoint="https://api.cogeo.xyz/", **kwargs):
def get_STAC_tile(url, bands=None, titiler_endpoint="https://titiler.xyz/", **kwargs):
"""Get a tile layer from a single SpatialTemporal Asset Catalog (STAC) item.
Args:
url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
tuple: Returns the COG Tile layer URL and bounds.
Expand Down Expand Up @@ -2542,12 +2542,12 @@ def get_STAC_tile(url, bands=None, titiler_endpoint="https://api.cogeo.xyz/", **
return r["tiles"][0]


def get_STAC_bounds(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_STAC_bounds(url, titiler_endpoint="https://titiler.xyz/"):
"""Get the bounding box of a single SpatialTemporal Asset Catalog (STAC) item.
Args:
url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
list: A list of values representing [left, bottom, right, top]
Expand All @@ -2565,12 +2565,12 @@ def get_STAC_bounds(url, titiler_endpoint="https://api.cogeo.xyz/"):
return bounds


def get_STAC_center(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_STAC_center(url, titiler_endpoint="https://titiler.xyz/"):
"""Get the centroid of a single SpatialTemporal Asset Catalog (STAC) item.
Args:
url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
tuple: A tuple representing (longitude, latitude)
Expand All @@ -2580,12 +2580,12 @@ def get_STAC_center(url, titiler_endpoint="https://api.cogeo.xyz/"):
return center


def get_STAC_bands(url, titiler_endpoint="https://api.cogeo.xyz/"):
def get_STAC_bands(url, titiler_endpoint="https://titiler.xyz/"):
"""Get band names of a single SpatialTemporal Asset Catalog (STAC) item.
Args:
url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
Returns:
list: A list of band names
Expand Down
12 changes: 6 additions & 6 deletions eefolium/eefolium.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def add_COG_layer(
attribution=".",
opacity=1.0,
shown=True,
titiler_endpoint = "https://api.cogeo.xyz/",
titiler_endpoint = "https://titiler.xyz/",
**kwargs
):
"""Adds a COG TileLayer to the map.
Expand All @@ -475,7 +475,7 @@ def add_COG_layer(
attribution (str, optional): The attribution to use. Defaults to '.'.
opacity (float, optional): The opacity of the layer. Defaults to 1.
shown (bool, optional): A flag indicating whether the layer should be on by default. Defaults to True.
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
"""
tile_url = get_COG_tile(url, titiler_endpoint, **kwargs)
center= get_COG_center(url, titiler_endpoint) # (lon, lat)
Expand All @@ -489,7 +489,7 @@ def add_COG_mosaic(
attribution=".",
opacity=1.0,
shown=True,
titiler_endpoint = "https://api.cogeo.xyz/",
titiler_endpoint = "https://titiler.xyz/",
username='anonymous',
overwrite=False,
show_footprints=False,
Expand All @@ -504,7 +504,7 @@ def add_COG_mosaic(
attribution (str, optional): The attribution to use. Defaults to '.'.
opacity (float, optional): The opacity of the layer. Defaults to 1.
shown (bool, optional): A flag indicating whether the layer should be on by default. Defaults to True.
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
username (str, optional): The username to create mosaic using the titiler endpoint. Defaults to 'anonymous'.
overwrite (bool, optional): Whether or not to replace existing layer with the same layer name. Defaults to False.
show_footprints (bool, optional): Whether or not to show footprints of COGs. Defaults to False.
Expand Down Expand Up @@ -548,7 +548,7 @@ def add_STAC_layer(
attribution=".",
opacity=1.0,
shown=True,
titiler_endpoint = "https://api.cogeo.xyz/",
titiler_endpoint = "https://titiler.xyz/",
**kwargs
):
"""Adds a STAC TileLayer to the map.
Expand All @@ -559,7 +559,7 @@ def add_STAC_layer(
attribution (str, optional): The attribution to use. Defaults to '.'.
opacity (float, optional): The opacity of the layer. Defaults to 1.
shown (bool, optional): A flag indicating whether the layer should be on by default. Defaults to True.
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://api.cogeo.xyz/".
titiler_endpoint (str, optional): Titiler endpoint. Defaults to "https://titiler.xyz/".
"""
tile_url = get_STAC_tile(url, bands, titiler_endpoint, **kwargs)
center= get_STAC_center(url, titiler_endpoint)
Expand Down

0 comments on commit 635af29

Please sign in to comment.