Skip to content

Instantly share code, notes, and snippets.

@metasim
Created September 12, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metasim/6144abd811a5a963ae3ac7735424072f to your computer and use it in GitHub Desktop.
Save metasim/6144abd811a5a963ae3ac7735424072f to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: Asset Catalog
version: 0.5.1
description: >-
This is a derivation of the <a href="https://raw.githubusercontent.com/radiantearth/stac-spec/master/api-spec/STAC-standalone-swagger2.yaml">STAC API Specification</a>.
This is an OpenAPI definition of the core SpatioTemporal Asset Catalog API
specification. Any service that implements this endpoint to allow search of
spatiotemporal assets can be considered a STAC API. The endpoint is also
available as an OpenAPI fragment that can be integrated with other OpenAPI
definitions, and is designed to slot seamless into a WFS 3 API definition.
license:
name: CC-BY 4.0 license
url: 'https://creativecommons.org/licenses/by/4.0/'
schemes:
- http
host: localhost:34456
basePath: /
paths:
/search/stac:
get:
summary: >-
retrieve items matching filters. Intended as a shorthand API for simple
queries. This method is optional.
operationId: getSearchSTAC
parameters:
- $ref: '#/parameters/bbox'
- $ref: '#/parameters/time'
- $ref: '#/parameters/limit'
produces:
- application/geo+json
responses:
'200':
description: A feature collection matching the search criteria.
schema:
$ref: '#/definitions/itemCollection'
# default:
# description: An error occured.
# schema:
# $ref: '#/definitions/exception'
parameters:
limit:
name: limit
in: query
description: |
The optional limit parameter limits the number of items that are
presented in the response document.
Only items are counted that are on the first level of the collection in
the response document. Nested objects contained within the explicitly
requested items shall not be counted.
* Minimum = 1
* Maximum = 10000
* Default = 10
required: false
type: integer
minimum: 1
maximum: 10000
default: 10
bbox:
name: bbox
in: query
description: |
Only features that have a geometry that intersects the bounding box are
selected. The bounding box is provided as four or six numbers,
depending on whether the coordinate reference system includes a
vertical axis (elevation or depth):
* Lower left corner, coordinate axis 1
* Lower left corner, coordinate axis 2
* Lower left corner, coordinate axis 3 (optional)
* Upper right corner, coordinate axis 1
* Upper right corner, coordinate axis 2
* Upper right corner, coordinate axis 3 (optional)
The coordinate reference system of the values is WGS84
longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless
a different coordinate reference system is specified in the parameter
`bbox-crs`.
For WGS84 longitude/latitude the values are in most cases the sequence
of minimum longitude, minimum latitude, maximum longitude and maximum
latitude. However, in cases where the box spans the antimeridian the
first value (west-most box edge) is larger than the third value
(east-most box edge).
If a feature has multiple spatial geometry properties, it is the
decision of the server whether only a single spatial geometry property
is used to determine the extent or all relevant geometries.
required: false
type: array
minItems: 4
maxItems: 6
items:
type: number
collectionFormat: csv
time:
name: time
in: query
description: |
Either a date-time or a period string that adheres to RFC 3339. Examples:
* A date-time: "2018-02-12T23:20:50Z"
* A period:
"2018-02-12T00:00:00Z/2018-03-18T12:31:12Z" or
"2018-02-12T00:00:00Z/P1M6DT12H31M12S"
Only features that have a temporal property that intersects the value of
`time` are selected.
If a feature has multiple temporal properties, it is the decision of the
server whether only a single temporal property is used to determine the
extent or all relevant temporal properties.
required: false
type: string
collectionId:
name: collectionId
in: path
required: true
description: Identifier (name) of a specific collection
type: string
featureId:
name: featureId
in: path
description: Local identifier of a specific feature
required: true
type: string
definitions:
exception:
type: object
required:
- code
properties:
code:
type: string
description:
type: string
link:
type: object
required:
- href
properties:
href:
type: string
rel:
type: string
example: prev
bboxFilter:
type: object
description: Only return items that intersect the provided bounding box.
properties:
bbox:
$ref: '#/definitions/bbox'
bbox:
type: array
minItems: 4
maxItems: 6
items:
type: number
description: |
Only features that have a geometry that intersects the bounding box are
selected. The bounding box is provided as four or six numbers,
depending on whether the coordinate reference system includes a
vertical axis (elevation or depth):
* Lower left corner, coordinate axis 1
* Lower left corner, coordinate axis 2
* Lower left corner, coordinate axis 3 (optional)
* Upper right corner, coordinate axis 1
* Upper right corner, coordinate axis 2
* Upper right corner, coordinate axis 3 (optional)
The coordinate reference system of the values is WGS84
longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless
a different coordinate reference system is specified in the parameter
`bbox-crs`.
For WGS84 longitude/latitude the values are in most cases the sequence
of minimum longitude, minimum latitude, maximum longitude and maximum
latitude. However, in cases where the box spans the antimeridian the
first value (west-most box edge) is larger than the third value
(east-most box edge).
If a feature has multiple spatial geometry properties, it is the
decision of the server whether only a single spatial geometry property
is used to determine the extent or all relevant geometries.
example:
- -110
- 39.5
- -105
- 40.5
timeFilter:
description: An object representing a time based filter.
type: object
properties:
time:
$ref: '#/definitions/time'
time:
type: string
description: |
Either a date-time or a period string that adheres to RFC 3339. Examples:
* A date-time: "2018-02-12T23:20:50Z"
* A period:
"2018-02-12T00:00:00Z/2018-03-18T12:31:12Z" or
"2018-02-12T00:00:00Z/P1M6DT12H31M12S"
Only features that have a temporal property that intersects the value of
`time` are selected.
If a feature has multiple temporal properties, it is the decision of the
server whether only a single temporal property is used to determine the
extent or all relevant temporal properties.
example: '2018-02-12T00:00:00Z/2018-03-18T12:31:12Z'
intersectsFilter:
type: object
description: Only returns items that intersect with the provided polygon.
properties:
intersects:
$ref: '#/definitions/polygon'
polygon:
type: object
properties:
type:
type: string
enum:
- polygon
coordinates:
$ref: '#/definitions/polygon2D'
required:
- type
- coordinates
polygon2D:
type: array
minItems: 1
items:
$ref: '#/definitions/linearRing2D'
linearRing2D:
type: array
minItems: 4
items:
$ref: '#/definitions/point2D'
example:
- - -104
- 35
- - -103
- 35
- - -103
- 34
- - -104
- 34
- - -104
- 35
point2D:
description: A 2d geojson point
type: array
minimum: 2
maximum: 2
items:
type: number
format: double
example:
- -104
- 35
itemCollection:
type: object
required:
- features
- type
properties:
type:
type: string
enum:
- FeatureCollection
features:
type: array
items:
$ref: '#/definitions/item'
links:
$ref: '#/definitions/itemCollectionLinks'
item:
type: object
required:
- id
- type
- geometry
- links
- properties
- assets
properties:
id:
type: string
example: path/to/example.tif
description: 'unique ID, potentially link to file'
bbox:
$ref: '#/definitions/bbox'
geometry:
type: object
description: footprint of the item
type:
type: string
description: The GeoJSON type
enum:
- Feature
properties:
$ref: '#/definitions/itemProperties'
links:
type: object
additionalProperties:
type: object
required:
- href
- rel
properties:
href:
type: string
rel:
type: string
assets:
type: object
additionalProperties:
type: object
required:
- href
properties:
href:
type: string
name:
type: string
example:
type: Feature
id: CS3-20160503_132130_04
bbox:
- -122.59750209
- 37.48803556
- -122.2880486
- 37.613537207
geometry:
type: Polygon
coordinates:
- - - -122.308150179
- 37.488035566
- - -122.597502109
- 37.538869539
- - -122.576687533
- 37.613537207
- - -122.2880486
- 37.562818007
- - -122.308150179
- 37.488035566
properties:
datetime: '2016-05-03T13:21:30.040Z'
provider: 'http://www.cool-sat.com'
license: CC-BY-4.0
links:
self:
rel: self
href: >-
http://cool-sat.com/catalog/collections/cs/items/CS3-20160503_132130_04.json
assets:
analytic:
name: 4-Band Analytic
href: >-
http://cool-sat.com/catalog/collections/cs/items/CS3-20160503_132130_04/analytic.tif
thumbnail:
name: thumbnail
href: >-
http://cool-sat.com/catalog/collections/cs/items/CS3-20160503_132130_04/thumb.png
itemProperties:
type: object
required:
- datetime
description: provides the core metatdata fields plus extensions
properties:
datetime:
$ref: '#/definitions/time'
provider:
type: string
description: Information about the provider
license:
type: string
description: Data license name based on SPDX License List
additionalProperties:
type: object
itemCollectionLinks:
type: object
properties:
next:
type: string
description: >-
A URL to obtain the next paginated data set. If not present, the
client should utilize the `nextPageToken`.
example: >-
http://api.cool-sat.com/query/gasd312fsaeg/ANsXtp9mrqN0yrKWhf-y2PUpHRLQb1GT-mtxNcXou8TwkXhi1Jbk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment