-
Notifications
You must be signed in to change notification settings - Fork 12
WMTS & GIBS Collection Integration #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sandrahoang686
wants to merge
3
commits into
docs-external-collection-indexing
Choose a base branch
from
docs-external-collection-indexing-wmts
base: docs-external-collection-indexing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
user-guide/content-curation/external-collection-indexing/wmts.qmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| --- | ||
| title: Web Map Tile Service Integration | ||
| subtitle: Indexing OGC Web Map Tile Services for STAC collection creation | ||
| --- | ||
|
|
||
| [OGCWeb Map Tile Service (WMTS)](https://www.ogc.org/standards/wmts/) | ||
| A WMTS enabled server application can serve map tiles of spatially referenced data using tile images with predefined content, extent, and resolution. | ||
|
|
||
| ## Overview | ||
| Web Map Tile Service (WMTS) is normally used for interactive web mapping, but may be used for general visualizations and data analysis. WMTS is much more responsive for interactive maps and very scalable for generating large images or bulk downloads. | ||
|
|
||
| NASA's Global Imagery Browse Services (GIBS) API leverages the OGC WMTS specification to deliver the collections of NASA satellite imagery. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ```{mermaid} | ||
| graph LR | ||
| A[WMTS Server] --> B[GIBS API] | ||
| B --> C[STAC Collection] | ||
| C --> D[VEDA Catalog] | ||
|
|
||
| subgraph "Services" | ||
| E[Pre-rendered Map Tiles] | ||
| F[Layer Capabilities] | ||
| end | ||
|
|
||
| E --> B | ||
| F --> B | ||
|
|
||
| subgraph "VEDA Integration" | ||
| H[Dashboard Visualization] | ||
| I[API Access] | ||
| J[Data Discovery] | ||
| end | ||
|
|
||
| D --> H | ||
| D --> I | ||
| D --> J | ||
| ``` | ||
|
|
||
| ## Schema | ||
| The [GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303 collection](https://staging.openveda.cloud/api/stac/collections/GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303) is an example of a STAC compliant collection that implements the web map links extension for a GIBS hosted dataset. | ||
|
|
||
| This [stac-browser preview](https://radiantearth.github.io/stac-browser/#/external/staging.openveda.cloud/api/stac/collections/GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303?.language=en) for the collection mentioned above shows how the web map links supports dynamic visualization of the data utilizing pre-rendered map tiles. | ||
|
|
||
| To integrate WMTS capabilities into a STAC collection, you need to implement the [web map links extension](https://github.com/stac-extensions/web-map-links). | ||
|
|
||
| ### Implementing Web Map Link Extensions for GIBS hosted datasets | ||
| In this section, we will explain what is needed to create a web map link extension for a GIBS hosted dataset for WMTS map layers. | ||
|
|
||
| #### Extension Structure | ||
|
|
||
| JSON Schema for Web Map Link extensions can be found [here](https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json). | ||
|
|
||
| The extension would extend the **Link Object** in all the STAC entities (Items, Collections, Catalogs). | ||
|
|
||
| The `rel` field is required and indicates the type of web map link. For example `wms` for a Web Map Service or `wmts` for a Web Map Tile Service. In this case, we would use `wmts`. But the full list of valid `rel` field values and additional metadata for that specific extension type can be found in the [web-map-links docs](https://github.com/stac-extensions/web-map-links?tab=readme-ov-file#link-object-fields). | ||
|
|
||
| The `href` field is also required and indicates the URL of the web map link. In this case, the value would be `"https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi"`. | ||
|
|
||
| ##### Creation | ||
|
|
||
| To create this Web Map Link Extension, define an object with `"rel": "wmts"` and `"href": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi"` and then add any additional metadata. | ||
|
|
||
| The extension object would look like this: | ||
| ```json | ||
| { | ||
| "rel": "wmts", | ||
| "href": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi", // Required: Link to the WMTS wihtout any specific query parameters | ||
| "type": "image/png", // Media type to be used for the tile requests | ||
| "title": "Visualized through a WMTS", | ||
| "wmts:layer": [ | ||
| "GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303" // Required: specific layers to show on map by default. Can be a list of layer names or a single layer name | ||
| ], | ||
| "href:servers": [ // Specifies a set of URLs for a web mapping library so requests can be sent to multiple servers to avoid request limits | ||
| "https://gibs-a.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi", | ||
| "https://gibs-b.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi" | ||
| ], | ||
| "wmts:dimensions": { // Any additional dimension parameters | ||
| "STYLE": "default" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| With this extension, you would add it to your STAC compliant collection object within the `links` array. Please reference the [example above](./wmts.html#schema) as an example. | ||
|
|
||
| ## GIBS API for WMTS Capabilties | ||
| To access the WMTS capabilties XML documents exchanged within the WMTS standard, the `GetCapabilities` request can be used. | ||
|
|
||
| ```python | ||
| # Construct WMTS capability URL. | ||
| wmtsUrl = 'http://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi?SERVICE=WMTS&REQUEST=GetCapabilities' | ||
|
|
||
| # Request capabilities. | ||
| response = requests.get(wmtsUrl) | ||
|
|
||
| # Display capability XML. | ||
| WmtsXml = xmltree.fromstring(response.content) | ||
|
|
||
| # Uncomment the following to display the large file: | ||
| # print(xmltree.tostring(WmtsXml, pretty_print = True, encoding = str)) | ||
| ``` | ||
| This will return the WMTS capabilities document in XML format for all NASA GIBS hosted dataset layers. | ||
|
|
||
| To return a single layer's capabilities, you would have to parse the XML response. Below is an example of a bash script to filter the GetCapabilities response for a specific layer, `GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303`. | ||
|
|
||
| ```bash | ||
| curl 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi?service=wmts&request=GetCapabilities' | xq '.Capabilities.Contents.Layer[] | select( .["ows:Identifier"] | contains("GEDI_ISS_L3_Canopy_Height_Mean_RH100_201904-202303"))' | ||
| ``` | ||
| > TIP: yq is a jq wrapper that can be used to parse XML as JSON | ||
|
|
||
| ```json | ||
| // response | ||
| "ows:Title": { | ||
| "@xml:lang": "en", | ||
| "#text": "Canopy Height Mean (L3, RH100, 201904-202303, GEDI, ISS)" | ||
| }, | ||
|
|
||
| "ows:WGS84BoundingBox": { | ||
| "@crs": "urn:ogc:def:crs:OGC:2:84", | ||
| "ows:LowerCorner": "-180 -85.051129", | ||
| "ows:UpperCorner": "180 85.051129" | ||
| }, | ||
|
|
||
| "Style": { | ||
| "@isDefault": "true", | ||
| "ows:Title": { | ||
| "@xml:lang": "en", | ||
| "#text": "default" | ||
| }, | ||
| "ows:Identifier": "default", | ||
| "LegendURL": [ | ||
| { | ||
| "@xlink:title": "GIBS Color Map Legend: Horizontal", | ||
| "@xlink:href": "https://gibs.earthdata.nasa.gov/legends/GEDI_RH100_Mean_Color_Index_H.svg", | ||
| "@xlink:role": "http://earthdata.nasa.gov/gibs/legend-type/horizontal", | ||
| "@height": "86", | ||
| "@format": "image/svg+xml", | ||
| "@width": "378", | ||
| "@xlink:type": "simple" | ||
| }, | ||
| { | ||
| "@xlink:title": "GIBS Color Map Legend: Vertical", | ||
| "@xlink:href": "https://gibs.earthdata.nasa.gov/legends/GEDI_RH100_Mean_Color_Index_V.svg", | ||
| "@xlink:role": "http://earthdata.nasa.gov/gibs/legend-type/vertical", | ||
| "@height": "288", | ||
| "@format": "image/svg+xml", | ||
| "@width": "135", | ||
| "@xlink:type": "simple" | ||
| } | ||
| ] | ||
| }, | ||
|
|
||
| "Dimension": { | ||
| "ows:Identifier": "Time", | ||
| "ows:UOM": "ISO8601", | ||
| "Default": "2019-04-18", | ||
| "Current": "false", | ||
| "Value": "2019-04-18/2019-04-18/P1429D" | ||
| }, | ||
|
|
||
| "TileMatrixSetLink": { | ||
| "TileMatrixSet": "GoogleMapsCompatible_Level7" | ||
| }, | ||
|
|
||
| ``` | ||
|
|
||
| In this response, there is useful info for populating STAC metadata and to inform visualization expectations -- note the `"TileMatrixSet": "GoogleMapsCompatible_Level7"` tells us that tiles are only provided up to zoom level 7. At higher zooms, the tiles will become blurry. | ||
|
|
||
|
|
||
| ## Related Resources | ||
|
|
||
| - [GIBS API GET WMTS Capabilities](https://nasa-gibs.github.io/gibs-api-docs/python-usage/#get-wmts-capabilities) | ||
| - [OGC WMTS Specification](https://www.ogc.org/standard/wmts/) | ||
| - [STAC Web Map Links Extenstions (WML)](https://github.com/stac-extensions/web-map-links?tab=readme-ov-file#web-map-links-extension-specification) | ||
| - [STAC Specification](https://stacspec.org/) | ||
| - [VEDA Dataset Configuration Guide](../dashboard-configuration/dataset-configuration.qmd) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the ArcGIS section above also covers some WMT/S examples I think we could make this specific to the GIBS service...Or we could add a subpage to the ArcGIS section for these GIBS and WMT/S examples? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make this documentation more GIBS services specific in that case then? I'm unaware of the connection between ArcGIS and and GIBS services though so not sure where/how to add it as a subpage, I can though if thats what makes sense given some context!