openapi: 3.0.0
info:
   version: '1.0'
   title: OGC API - Maps
   description: |-
      Example API Definition for OGC API - Maps - Part 1: Core
   contact:
      name: Open Geospatial Consortium
      email: info@ogc.org
   license:
      name: OGC License
      url: http://www.opengeospatial.org/legal/
servers:
  - description: Example OGC API - Maps server
    url: https://maps.gnosis.earth/ogcapi
paths:
   # OGC API - Common - Part 1: Core
   /:
      $ref: 'paths/common-core/pLandingPage.yaml'
   /conformance:
      $ref: 'paths/common-core/pConformance.yaml'
   /api:
      $ref: 'paths/common-core/pAPI.yaml'

   # Dynamic enumeration of resources specific to this implementation
   /api/all-collections:
      $ref: 'paths/dynamic/pAllCollections.yaml'
   /api/tileMatrixSets:
      $ref: 'paths/dynamic/pTileMatrixSets.yaml'
   /api/styles:
      $ref: 'paths/dynamic/pStyles.yaml'

   # OGC API - Common - Part 2: Geospatial data
   /collections:
      $ref: 'paths/common-geodata/pCollectionsList.yaml'
   /collections/{collectionId}:
      $ref: 'paths/common-geodata/pCollection.yaml'

   # OGC API - Maps - Part 1: Core

   # Data Set Map
   /map:
      $ref: 'paths/maps-core/pDataSetMap.yaml'

   # Data Set Map (styled)
   /styles/{styleId}/map:
      $ref: 'paths/maps-core/pStyledDataSetMap.yaml'

   # Collection Map
   /collections/{collectionId}/map:
      $ref: 'paths/maps-core/pCollectionMap.yaml'

   # Collection Map (styled)
   /collections/{collectionId}/styles/{styleId}/map:
      $ref: 'paths/maps-core/pStyledCollectionMap.yaml'

   # Custom CRS projections and datums
   /projectionsAndDatums:
      $ref: 'paths/maps-core/pProjections.yaml'

   # Shared Tile Matrix Set definitions
   /tileMatrixSets:
      $ref: 'paths/tiles-core/tileMatrixSets/pTileMatrixSetsList.yaml'
   /tileMatrixSets/{tileMatrixSetId}:
      $ref: 'paths/tiles-core/tileMatrixSets/pTileMatrixSet.yaml'

   # Map Tiles: Data Set Tile Sets
   /map/tiles:
      $ref: 'paths/tiles-core/dataset-tiles/map-tiles/pDataSetMapTileSetsList.yaml'
   /map/tiles/{tileMatrixSetId}:
      $ref: 'paths/tiles-core/dataset-tiles/map-tiles/pDataSetMapTileSet.yaml'
   /map/tiles/{tileMatrixSetId}/{tileMatrix}/{tileRow}/{tileCol}:
      $ref: 'paths/tiles-core/dataset-tiles/map-tiles/pDataSetMapTile.yaml'

   # Map Tiles: Data Set Tile Sets (styled)
   /styles/{styleId}/map/tiles:
      $ref: 'paths/tiles-core/dataset-tiles/styled-map-tiles/pStyledDataSetMapTileSetsList.yaml'
   /styles/{styleId}/map/tiles/{tileMatrixSetId}:
      $ref: 'paths/tiles-core/dataset-tiles/styled-map-tiles/pStyledDataSetMapTileSet.yaml'
   /styles/{styleId}/map/tiles/{tileMatrixSetId}/{tileMatrix}/{tileRow}/{tileCol}:
      $ref: 'paths/tiles-core/dataset-tiles/styled-map-tiles/pStyledDataSetMapTile.yaml'

   # Map Tiles: Collection Tile Sets
   /collections/{collectionId}/map/tiles:
      $ref: 'paths/tiles-core/collection-tiles/map-tiles/pCollectionMapTileSetsList.yaml'
   /collections/{collectionId}/map/tiles/{tileMatrixSetId}:
      $ref: 'paths/tiles-core/collection-tiles/map-tiles/pCollectionMapTileSet.yaml'
   /collections/{collectionId}/map/tiles/{tileMatrixSetId}/{tileMatrix}/{tileRow}/{tileCol}:
      $ref: 'paths/tiles-core/collection-tiles/map-tiles/pCollectionMapTile.yaml'

   # Map Tiles: Collection Tile Sets (styled)
   /collections/{collectionId}/styles/{styleId}/map/tiles:
      $ref: 'paths/tiles-core/collection-tiles/styled-map-tiles/pStyledCollectionMapTileSetsList.yaml'
   /collections/{collectionId}/styles/{styleId}/map/tiles/{tileMatrixSetId}:
      $ref: 'paths/tiles-core/collection-tiles/styled-map-tiles/pStyledCollectionMapTileSet.yaml'
   /collections/{collectionId}/styles/{styleId}/map/tiles/{tileMatrixSetId}/{tileMatrix}/{tileRow}/{tileCol}:
      $ref: 'paths/tiles-core/collection-tiles/styled-map-tiles/pStyledCollectionMapTile.yaml'

components:
   schemas:
      # $ref: './schemas/index.yaml' # Not supported?
      # https://davidgarcia.dev/posts/how-to-split-open-api-spec-into-multiple-files/ vs.
      # https://stackoverflow.com/questions/64940379/ref-ing-multiple-files-at-the-components-schemas-top-level-in-openapi-3

      # Common - Core
      confClasses:
         $ref: 'schemas/common-core/confClasses.yaml'
      link:
         $ref: 'schemas/common-core/link.yaml'
      landingPage:
         $ref: 'schemas/common-core/landingPage.yaml'
      exception:
         $ref: 'schemas/common-core/exception.yaml'

      # Common - Geospatial Data
      collections:
         $ref: 'schemas/common-geodata/collections.yaml'
      collectionDesc:
         $ref: 'schemas/common-geodata/collectionDesc.yaml'
      extent:
         $ref: 'schemas/common-geodata/extent.yaml'
      extent-uad:
         $ref: 'schemas/common-geodata/extent-uad.yaml'
      crs:
         $ref: 'schemas/common-geodata/crs.yaml'
      dataType:
         $ref: 'schemas/common-geodata/dataType.yaml'
      timeStamp:
         $ref: 'schemas/common-geodata/timeStamp.yaml'
      # projJSON:
      #   $ref: 'schemas/common-geodata/projJSON.yaml'
      numberReturned:
         $ref: 'schemas/common-geodata/numberReturned.yaml'
      numberMatched:
         $ref: 'schemas/common-geodata/numberMatched.yaml'

      # 2D Tile Matrix Set & Tile Set Metadata
      tileSet:
         $ref: 'schemas/tms/tileSet.yaml'
      tileSet-item:
         $ref: 'schemas/tms/tileSet-item.yaml'
      tileMatrixSet:
         $ref: 'schemas/tms/tileMatrixSet.yaml'
      tileMatrixSet-item:
         $ref: 'schemas/tms/tileMatrixSet-item.yaml'
      tileMatrixLimits:
         $ref: 'schemas/tms/tileMatrixLimits.yaml'
      2DPoint:
         $ref: 'schemas/tms/2DPoint.yaml'
      2DBoundingBox:
         $ref: 'schemas/tms/2DBoundingBox.yaml'

      # Dynamic (or implementation-specific)
      enumeration:
         $ref: 'schemas/dynamic/enumeration.yaml'

      all-collections:
         $ref: 'schemas/dynamic/all-collections.yaml'
      styles:
         $ref: 'schemas/dynamic/styles.yaml'
      tileMatrixSets:
         $ref: 'schemas/dynamic/tileMatrixSets.yaml'

   parameters:
      # Common - Core
      f-metadata:
         $ref: 'parameters/unspecified/f-metadata.yaml'

      # Common - Geospatial data
      collectionId-all:
         $ref: 'parameters/common-geodata/collectionId-all.yaml'
      bbox:
         $ref: 'parameters/common-geodata/bbox.yaml'
      datetime:
         $ref: 'parameters/common-geodata/datetime.yaml'

      # Maps - Core
      crs:
         $ref: 'parameters/maps-core/crs.yaml'
      bbox-crs:
         $ref: 'parameters/maps-core/bbox-crs.yaml'
      subset-crs:
         $ref: 'parameters/maps-core/subset-crs.yaml'
      collections:
         $ref: 'parameters/maps-core/collections.yaml'
      subset:
         $ref: 'parameters/maps-core/subset.yaml'
      bgcolor:
         $ref: 'parameters/maps-core/bgcolor.yaml'
      transparent:
         $ref: 'parameters/maps-core/transparent.yaml'
      void-color:
         $ref: 'parameters/maps-core/void-color.yaml'
      void-transparent:
         $ref: 'parameters/maps-core/void-transparent.yaml'
      width:
         $ref: 'parameters/maps-core/width.yaml'
      height:
         $ref: 'parameters/maps-core/height.yaml'
      center:
         $ref: 'parameters/maps-core/center.yaml'
      center-crs:
         $ref: 'parameters/maps-core/center-crs.yaml'
      scale-denominator:
         $ref: 'parameters/maps-core/scale-denominator.yaml'
      mm-per-pixel:
         $ref: 'parameters/maps-core/mm-per-pixel.yaml'
      orientation:
         $ref: 'parameters/maps-core/orientation.yaml'
      crs-proj-method:
         $ref: 'parameters/maps-core/crs-proj-method.yaml'
      crs-proj-center:
         $ref: 'parameters/maps-core/crs-proj-center.yaml'
      crs-proj-params:
         $ref: 'parameters/maps-core/crs-proj-params.yaml'
      crs-datum:
         $ref: 'parameters/maps-core/crs-datum.yaml'

      # Maps - Core (unspecified)
      f-map:
         $ref: 'parameters/unspecified/f-map.yaml'

      # Styles - Core
      styleId:
         $ref: 'parameters/styles-core/styleId.yaml'
      styleId-collection:
         $ref: 'parameters/styles-core/styleId-collection.yaml'

      # Tiles - Core
      tileMatrix:
         $ref: 'parameters/tiles-core/tileMatrix.yaml'
      tileRow:
         $ref: 'parameters/tiles-core/tileRow.yaml'
      tileCol:
         $ref: 'parameters/tiles-core/tileCol.yaml'

      # Tiles - Core (unspecified)
      tileMatrixSetId:
         $ref: 'parameters/unspecified/tileMatrixSetId.yaml'
      f-mapTile:
         $ref: 'parameters/unspecified/f-mapTile.yaml'

   responses:
      # Generic Errors
      NotFound:
         $ref: 'responses/common-core/rNotFound.yaml'
      NotAcceptable:
         $ref: 'responses/common-core/rNotAcceptable.yaml'
      ServerError:
         $ref: 'responses/common-core/rServerError.yaml'
      InvalidParameter:
         $ref: 'responses/common-core/rInvalidParameter.yaml'
      Exception:
         $ref: 'responses/common-core/rException.yaml'

      # Common - Core
      LandingPage:
         $ref: 'responses/common-core/rLandingPage.yaml'
      Conformance:
         $ref: 'responses/common-core/rConformance.yaml'
      API:
         $ref: 'responses/common-core/rAPI.yaml'

      # Dynamic enumeration of resources specific to this implementation
      Enumeration:
         $ref: 'responses/dynamic/rEnumeration.yaml'

      # Common - Geospatial Data
      CollectionsList:
         $ref: 'responses/common-geodata/rCollectionsList.yaml'
      Collection:
         $ref: 'responses/common-geodata/rCollection.yaml'

      # Maps - Core
      Map:
         $ref: 'responses/maps-core/rMap.yaml'
      EmptyMap:
         $ref: 'responses/maps-core/rEmptyMap.yaml'

      # Tiles - Core
      TileSetsList:
         $ref: 'responses/tiles-core/rTileSetsList.yaml'
      TileSet:
         $ref: 'responses/tiles-core/rTileSet.yaml'
      MapTile:
         $ref: 'responses/tiles-core/rMapTile.yaml'
      EmptyTile:
         $ref: 'responses/tiles-core/rEmptyTile.yaml'
      TileMatrixSetsList:
         $ref: 'responses/tiles-core/rTileMatrixSetsList.yaml'
      TileMatrixSet:
         $ref: 'responses/tiles-core/rTileMatrixSet.yaml'
