Skip to content

Customize and use STAC

Marten edited this page Oct 4, 2024 · 8 revisions

Customize and use STAC (Version 2.7.2)

As of 2.7.1 Geoportal Server implements the Spatio-Temporal Asset Catalogs (STAC). The SpatioTemporal Asset Catalog (STAC) family of specifications aim to standardize the way geospatial asset metadata is structured and queried. A 'spatiotemporal asset' is any file that represents information about the Earth captured in a certain space and time.

This page contains information about the support for STAC and the corresponding STAC API in Geoportal Server.

Use STAC

Access the url at http://servername:8080/geoportal/stac, it will show the STAC landing page. From here, you can access the collections end point, and dive further into a collection and its items. The implemented STAC API is accessible via the API tab in the Geoportal application.

Populating the index for STAC use

STAC items are GeoJSON Feature documents and can be directly published to Geoportal Server. A couple notes:

  • If you want to support STAC collections, please follow below steps:
  1. Set supportsCollections to true in app-config.xml.
  2. Add Collection using POST request for http://localhost:8080/geoportal/stac/collections
  3. Collection Specification https://github.com/radiantearth/stac-spec/blob/master/collection-spec/collection-spec.md
  4. Sample collection https://github.com/radiantearth/stac-spec/blob/master/examples/collection-only/collection.json
  • If you want the thumbnail of the STAC item to show in the Geoportal search page, include a field thumbnail_s in the JSON with a value pointing to the image: "thumbnail_s": "https://www.example.com/image.jpg".
  • Update /WEB-INF/classes/service/config STAC files to map fields from your JSON to output fields. This allows including namespaces or renaming of fields in the JSON to what you'd like them called in the STAC result. This also allows you to include more elaborate descrptions of your STAC.

Configure Geoportal Server to enable the STAC transaction extension:

app-context.xml

  <beans:property name="numStacFeaturesAddItem" value="500" />
  <beans:property name="validateStacFields" value="false" />
Parameter Name Description
numStacFeaturesAddItem Number of features allowed in FeatureCollection in POST request to prevent service timeout.
validateStacFields validate feature in POST and PUT request as per https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md. default is false.

Security in STAC Service

The STAC Transaction service is secured similar to the Geoportal application itself: http://servername:8080/geoportal/stac/collections/** are secured by Spring oAuth. For simple Authentication, generate token and then append token to request.

1. Generate token ->
POST http://localhost:8080/geoportal/oauth/token

username:
password:
client_id:geoportal-client
grant_type:password\

2. Append token
POST http://localhost:8080/geoportal/stac/collections/{collectionID}/items?access_token=token_generated_above
Clone this wiki locally