github.com/PDOK/gokoala@v0.50.6/internal/ogc/common/geospatial/templates/collections.go.json (about)

     1  {{- /*gotype: github.com/PDOK/gokoala/internal/engine.TemplateData*/ -}}
     2  {
     3    {{ $cfg := .Config }}
     4    {{ $baseUrl := $cfg.BaseURL }}
     5    "links" : [
     6      {
     7        "rel" : "self",
     8        "type" : "application/json",
     9        "title" : "This document as JSON",
    10        "href" : "{{ $baseUrl }}/collections?f=json"
    11      },
    12      {
    13        "rel" : "alternate",
    14        "type" : "text/html",
    15        "title" : "This document as HTML",
    16        "href" : "{{ $baseUrl }}/collections?f=html"
    17      }
    18    ],
    19    "collections" : [
    20      {{ range $index, $coll := $cfg.AllCollections.Unique }}
    21      {{/* TIP: temporarily disable the line below to fix intellij/goland highlighting */}}
    22      {{ if $index }},{{ end }}
    23      {
    24        "id" : "{{ $coll.ID }}",
    25        {{ if and $coll.Metadata $coll.Metadata.Title }}
    26        "title" : "{{ $coll.Metadata.Title }}"
    27        {{ else }}
    28        "title" : "{{ $coll.ID }}"
    29        {{ end }}
    30        {{ if and $coll.Metadata $coll.Metadata.Description }}
    31        ,"description" : "{{ unmarkdown $coll.Metadata.Description }}"
    32        {{ end }}
    33        {{ if and $cfg.OgcAPI.GeoVolumes $cfg.OgcAPI.GeoVolumes.Collections }}
    34          {{ if $cfg.OgcAPI.GeoVolumes.Collections.ContainsID $coll.ID }}
    35            ,"collectionType" : "3d-container"
    36          {{end}}
    37        {{end}}
    38        {{ if and $coll.Metadata $coll.Metadata.Extent }}
    39        ,"extent" : {
    40          "spatial": {
    41            "bbox": [ [ {{ $coll.Metadata.Extent.Bbox | join "," }} ] ],
    42            {{- if $coll.Metadata.Extent.Srs -}}
    43            "crs" : "http://www.opengis.net/def/crs/EPSG/0/{{ trimPrefix "EPSG:" $coll.Metadata.Extent.Srs }}"
    44            {{- else -}}
    45            "crs" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    46            {{- end -}}
    47          }
    48          {{- if and $coll.Metadata $coll.Metadata.Extent.Interval -}}
    49          ,"temporal": {
    50            "interval": [ [ {{ $coll.Metadata.Extent.Interval | join ", " }} ] ],
    51            "trs" : "http://www.opengis.net/def/uom/ISO-8601/0/Gregorian"
    52          }
    53          {{- end -}}
    54        }
    55        {{ end }}
    56        {{ if and $cfg.OgcAPI.Features $cfg.OgcAPI.Features.Collections }}
    57        ,"crs" : [
    58          "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    59          {{ range $index, $srs := $cfg.OgcAPI.Features.ProjectionsForCollection $coll.ID }}
    60          ,"http://www.opengis.net/def/crs/EPSG/0/{{ trimPrefix "EPSG:" $srs }}"
    61          {{ end }}
    62        ]
    63        {{ if and $coll.Metadata $coll.Metadata.StorageCrs }}
    64        ,"storageCrs" : "{{ $coll.Metadata.StorageCrs }}"
    65        {{ else }}
    66        ,"storageCrs" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    67        {{ end }}
    68        {{ end }}
    69        ,"links" : [
    70          {
    71            "rel" : "self",
    72            "type" : "application/json",
    73            "title" : "Information about the {{ $coll.ID }} collection as JSON",
    74            "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}?f=json"
    75          },
    76          {
    77            "rel" : "alternate",
    78            "type" : "text/html",
    79            "title" : "Information about the {{ $coll.ID }} collection as HTML",
    80            "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}?f=json"
    81          }
    82          {{ if and $cfg.OgcAPI.GeoVolumes $cfg.OgcAPI.GeoVolumes.Collections }}
    83            {{ if $cfg.OgcAPI.GeoVolumes.Collections.ContainsID $coll.ID }}
    84              {{ if and $coll.GeoVolumes $coll.GeoVolumes.Has3DTiles }}
    85              ,{
    86                "rel" : "items",
    87                "type" : "application/json+3dtiles",
    88                "title" : "Tileset definition of collection {{ $coll.ID }} according to the OGC 3D Tiles specification",
    89                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/3dtiles?f=json"
    90              }
    91              {{end}}
    92              {{ if and $coll.GeoVolumes $coll.GeoVolumes.HasDTM }}
    93              ,{
    94                "rel" : "items",
    95                "type" : "application/json",
    96                "title" : "Digital Terrain Model '{{ $coll.ID }}' in Quantized Mesh format",
    97                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/quantized-mesh?f=json"
    98              }
    99              {{end}}
   100            {{end}}
   101          {{end}}
   102          {{ if and $cfg.OgcAPI.Tiles $cfg.OgcAPI.Tiles.Collections }}
   103            {{ if $cfg.OgcAPI.Tiles.Collections.ContainsID $coll.ID }}
   104              ,{
   105                "rel" : "items",
   106                "type" : "application/json",
   107                "title" : "The JSON representation of the {{ $coll.ID }} tiles served from this endpoint",
   108                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/tiles?f=json"
   109              },
   110              {
   111                "rel" : "items",
   112                "type" : "text/html",
   113                "title" : "The HTML representation of the {{ $coll.ID }} tiles served from this endpoint",
   114                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/tiles?f=html"
   115              }
   116            {{end}}
   117          {{end}}
   118          {{ if and $cfg.OgcAPI.Features $cfg.OgcAPI.Features.Collections }}
   119            {{ if $cfg.OgcAPI.Features.Collections.ContainsID $coll.ID }}
   120              ,{
   121                "rel" : "items",
   122                "type" : "application/geo+json",
   123                "title" : "The JSON representation of the {{ $coll.ID }} features served from this endpoint",
   124                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/items?f=json"
   125              },
   126              {
   127                "rel" : "items",
   128                "type" : "application/vnd.ogc.fg+json",
   129                "title" : "The JSON-FG representation of the {{ $coll.ID }} features served from this endpoint",
   130                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/items?f=jsonfg"
   131              },
   132              {
   133                "rel" : "items",
   134                "type" : "text/html",
   135                "title" : "The HTML representation of the {{ $coll.ID }} features served from this endpoint",
   136                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/items?f=html"
   137              }
   138              {{/* placeholder for more links*/}}
   139            {{end}}
   140          {{end}}
   141        ],
   142        "content" : [
   143          {{ if and $cfg.OgcAPI.GeoVolumes $cfg.OgcAPI.GeoVolumes.Collections }}
   144            {{ if $cfg.OgcAPI.GeoVolumes.Collections.ContainsID $coll.ID }}
   145              {{ if and $coll.GeoVolumes $coll.GeoVolumes.Has3DTiles }}
   146              {
   147                "rel" : "original",
   148                "type" : "application/json+3dtiles",
   149                "title" : "Tileset definition of collection {{ $coll.ID }} according to the OGC 3D Tiles specification",
   150                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}/3dtiles?f=json",
   151                "collectionType": "3d-container"
   152              }
   153              {{ else if and $coll.GeoVolumes $coll.GeoVolumes.HasDTM }}
   154              {
   155                "rel" : "original",
   156                "type" : "application/json",
   157                "title" : "Digital Terrain Model '{{ $coll.ID }}' in Quantized Mesh format",
   158                "href" : "{{ $baseUrl }}/collections/{{ $coll.ID }}?f=json",
   159                "collectionType": "3d-container"
   160              }
   161              {{end}}
   162            {{end}}
   163          {{end}}
   164        ]
   165      }
   166      {{end}}
   167    ]
   168  }