Skip to content

Commit

Permalink
Update the titiler endpoint
Browse files Browse the repository at this point in the history
Update the titiler endpoint
  • Loading branch information
giswqs authored Sep 7, 2023
2 parents f4ba02f + 5618aab commit 41fd8ce
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ jobs:
fail-fast: false
matrix:
config:
- { os: windows-latest, py: "3.7" }
- { os: macOS-latest, py: "3.7" }
- { os: ubuntu-latest, py: "3.6" }
- { os: ubuntu-latest, py: "3.7" }
- { os: windows-latest, py: "3.10" }
- { os: macOS-latest, py: "3.10" }
- { os: ubuntu-latest, py: "3.8" }
- { os: ubuntu-latest, py: "3.9" }
- { os: ubuntu-latest, py: "3.10" }
- { os: ubuntu-latest, py: "3.11" }

env:
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Expand All @@ -35,7 +36,7 @@ jobs:
python -m pip install --upgrade pip
pip install --user --no-cache-dir Cython
pip install --user -r requirements.txt
pip install --user -r requirements_dev.txt
# pip install --user -r requirements_dev.txt
- name: LOAD EE CREDENTIALS
run: python ./.github/ee_token.py
env:
Expand Down
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
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
description="A lightweight Python package for interactive mapping with Google Earth Engine and folium",
install_requires=install_requires,
Expand Down

0 comments on commit 41fd8ce

Please sign in to comment.