Skip to content

Database Schema and API Endpoints

Simon Annetts edited this page Mar 26, 2019 · 35 revisions

This document is Work In Progress and likely to change as the project develops.

Database Schema

The schema we have developed looks like this: Screenshot_2019-03-26_12-33-19

The tables are described as follows:

BaseLayer

This table holds a list of Baselayers that all Maps may reference. The fields are defined in the web-api code with comments that explain what they are for, so rather than re-describe each field again here I have just pasted the definitions from the web-api code for now:

        public long BaseLayerId { get; set; }   //Unique BaseLayer ID
        public string Name { get; set; }        //Unique BaseLayer Name
        public string Attribution { get; set; } //BaseLayer attribution text
        public string AttributionUrl { get; set; } //BaseLayer attribution URL
        public string Url { get; set; }         //the source WMS Url
        public string LayerName { get; set; }   //the name of the WMS Layer

MapInstance

This table holds the list of available Maps. Each Map record consists of the following fields which are defined in the web-api as:

        public long MapInstanceId { get; set; }     //Unique Map Instance ID
        public string Name { get; set; }            //Map name
        public string Description { get; set; }     //Map description (may contain HTML)
        public string Attribution { get; set; }     //Map Attribution (may contain HTML)
        public double MapCentreLon { get; set; }    //Initial Map Centre Longitude in EPSG:4326 (X)
        public double MapCentreLat { get; set; }    //Initial Map Centre Latitude in EPSG:4326 (Y)
        public int MapZoom { get; set; }            //Initial Map Zoom Level 1-22
        public int MaxZoom { get; set; }            //Maximum Zoom Level for this Map
        public string BaseLayerList { get; set; }   //Comma separated list of additional BaseLayers (either BaseLayerIds or Names)
        public string VisibleBaseLayer { get; set; }//which additional BaseLayer is initially visible? (either BaseLayerId or Name)

        //foreign keys
        public List<ExternalWmsUrl> ExternalWmsUrls { get; set; }
        public List<LayerGroup> LayerGroups { get; set; }

Note: Some of these database field names will be mapped to different names in the resulting API JSON output!

We chose to hold a list of baselayers in 'BaseLayerList' (which can be BaseLayerIds or Names) rather than hold the baselayers of each map in a child table, so that the baselayer definitions could be re-used across multiple maps without having to re-specify them over and over again. We also specify which 'VisibleBaseLayer' is visible by default (by Name or by BaseLayerId).

ExternalWmsUrl

This table holds a list of pre-defined external WMS urls that could be added to the map instance by the user.

        public long ExternalWmsUrlId { get; set; } //Unique External WMS ID
        public string Name { get; set; }        //External WMS Name
        public string Description { get; set; } //Short Descriptive text about the External WMS source (can contain HTML)
        public string Url { get; set; }         //URL of the WMS source

        //foreign keys
        public long MapInstanceId { get; set; }  //Which MapInstance do I belong to?

LayerGroup

This table holds the list of Layer Groups.

        public long LayerGroupId { get; set; }   //Unique LayerGroup ID
        public string Name { get; set; }         //Layer Group Name
        public string Description { get; set; }  //Short Descriptive text about the LayerGroup (can contain HTML)
        public long Order { get; set; }           //Initial Order for the Layer Group
        public Boolean IsExternal { get; set; }   //Is this Layer Group used for external Layers?

        //foreign keys
        public long MapInstanceId { get; set; }  //Which MapInstance do I belong to?

Layer

This is the list of Layers which belong to LayerGroups. Some layers can be further placed into a SubLayerGroup if this field is not null.

        public long LayerId { get; set; }         //Unique Layer ID
        public string Name { get; set; }         //Short Descriptive text about the layer (can contain HTML)
        public string MetadataDescription { get; set; } //(?) Icon after Layer Name to external page (hover text)
        public string MetadataUrl { get; set; }   //(?) Icon after Layer Name to external page (link URL)
        public string DownloadURL {get; set; }    //Link to download the dataset
        public string SubLayerGroup { get; set; } //Optional sub group to be grouped in or NULL
        public string Url { get; set; }           //Base Url not including filter params
        public string LayerName { get; set; }     //WMS or WMTS layer name
        public string LegendLayerName { get; set; } //The name of a single layer that provides the map key       
        public long LayerOrder { get; set; }           //Initial Order within the Layer Group (or SubLayerGroup)
        public Boolean LayerVisible { get; set; }      //Initial Visibility
        [Range(0.0f,1.0f)]
        public float LayerOpacity { get; set; }        //Initial Opacity
        public double LayerCentreLon { get; set; }    //Layer specific Centre Longitude in EPSG:4326 (X) - overrides Map centre
        public double LayerCentreLat { get; set; }    //Layer specific Centre Latitude in EPSG:4326 (Y) - overrides Map centre
        public int LayerZoom { get; set; }        //Layer specific Zoom Level 1-22 - overrides Map zoom
        
        //foreign keys
        public long LayerGroupId { get; set; }    //which LayerGroup am I in?

Note: Some of these database field names will be mapped to different names in the resulting API JSON output!

Filter

This is all still open to much discussion, but initially we have defined filters as follows:

        public long FilterId { get; set; }          //Unique Filter ID
        public string Name { get; set; }            //Filter Name
        public string Description { get; set; }     //Short Descriptive text about the filter (can contain HTML)
        public string MetadataUrl { get; set; }     //(?) icon to page with more info about the filter? 
        public string Type { get; set; }            //could be one of 'lookup' (multi select box) or 'text'
        public string Attribute { get; set; }       //name of the WMS attribute to send
        public string LookupCategory { get; set; }  //name of the Filter Category to look up
        public Boolean IsComplex { get; set; }      //is this complex filter, using SQL view viewparams instead of CQL?
         
        //foreign keys
        public long LayerId { get; set; }           //which Layer do I belong to?

We think it might work like this:

The 'Attribute' field is what needs to be sent to Geoserver in the query for the map, e.g. 'species='.

'Type' selects which kind of filter is presented in the user interface, so 'Date' would be a date picker, 'Boolean' would be a check box returning 'true' or 'false', and 'Text' is a text box for any text. The other two, 'Lookup' and 'LookupMulti' provide the user with a choice of items in a select box or multi-select box respectively.

Values for 'Date', 'Boolean' and 'Text' are sent as a WMS parameter defined by the 'Attribute' field to the Geoserver, either as an OGC XML query (simple filters) or as a SQL VIEW query (complex filters) .

If the Type is 'Lookup', then the Map will perform a query to the web-api URL '/api/Lookup/{LookupCategory}' with the value of the 'LookupCategory' field. The API will return an array of JSON objects, each containing a 'code' and 'name' properties. The code(s) (single select or multi select) are valid values that should be sent as a WMS parameter(s) defined by the 'Attribute' field to the Geoserver, either as an CQL query (simple filters) or as a SQL VIEW query (complex filters) .

Here is an example of a typical 'Filter' entry in the database:

 'Name' = 'MyFilter'
 'Description' = "My Example Filer" 
 'Type' = 'Lookup'
 'Attribute' = 'species'
 'LookupCategory' = 'Species'.

We use the 'LookupCategory' value to query the web-api for a list of code and name properties to populate a drop down list box in the UI.

A call to '/api/Lookup/Species will be given a list (in JSON):

[
    {
      "lookupId": 1,
      "code": "SP0",
      "name": "Species 0",
      "lookupCategory": "Species"
    },
    {
      "lookupId": 2,
      "code": "SP1",
      "name": "Species 1",
      "lookupCategory": "Species"
    },
    {
      "lookupId": 3,
      "code": "SP2",
      "name": "Species 2",
      "lookupCategory": "Species"
    },
    {
      "lookupId": 4,
      "code": "SP3",
      "name": "Species 3",
      "lookupCategory": "Species"
    },
    {
      "lookupId": 5,
      "code": "SP4",
      "name": "Species 4",
      "lookupCategory": "Species"
    },
    {
      "lookupId": 6,
      "code": "SP5",
      "name": "Species 5",
      "lookupCategory": "Species"
    }
]

The map can then display a drop down containing all of the returned species. The user selects 'Species 3', and the map queries the Geoserver with a CQL filter query as shown in the example below.

http://jnccdev-geo.esdm.co.uk/emodnet/wms?service=WMS&version=1.1.0&request=GetMap&layers=emodnet:eusm2016_200&
styles=&bbox=-4047295.25,2907255.5,4693708.0,1.272164E7&width=684&height=768&srs=EPSG:3857&format=image/jpeg&
CQL_FILTER=hab_type%20IN%20(%27SP3%27)

Complex filters can be a lookup list (like the simple filter) and also free text input via a textboxt. It returns the parameters needed for a SQL view, e.g.:

http://jnccdev-geo.esdm.co.uk/emodnet/wms?service=WMS&version=1.1.0&request=GetMap&layers=emodnet:eusm2016_200&
styles=&bbox=-4047295.25,2907255.5,4693708.0,1.272164E7&width=684&height=768&srs=EPSG:3857&format=image/jpeg&
viewparams=species:SP3,substrate:mud

Lookup

This table holds all of the lookups that might be needed. They are all stored in one table, but lookup sets can be categorised so that particular LookupCategories can be queried for.

        public long LookupId { get; set; }      //unique Lookup ID
        public string Code { get; set; }        //lookup code (maps to value in a select box)
        public string Name { get; set; }        //lookup name (maps to the text in a select box)
        public string LookupCategory { get; set; } //which lookup category am I in?

Gazetteer

This table holds a lookup of place names to coordinates and zoom.

        public long GazetteerId { get; set; }   //unique Gazetteer ID
        public string Name { get; set; }        //PlaceName
        public string Category { get; set; }    //Gazetteer Category
        public double Xmin { get; set; }        //Extent X Min
        public double Ymin { get; set; }        //Extent Y Min
        public double Xmax { get; set; }        //Extent X Max
        public double Ymax { get; set; }        //Extent Y Max

Note: Some of these database field names will be mapped to different names in the resulting API JSON output!

API Endpoints

The following API endpoints are currently defined, and return real test data which is stored in the database. You can test them yourselves :)

Return a list of Maps

http://jnccdev-api.esdm.co.uk/api/MapId or http://jnccdev-api.esdm.co.uk/api/MapInstance Returns a JSON array of objects:

click to see example JSON output

{
"mapInstanceId": 7,
"name": "EMODnet",
"description": "<p>Configurable <strong>EMODnet</strong> description.</p><p><a href=\"http://www.emodnet.eu/\" target=\"_blank\">EMODnet</a></p>",
"attribution": "Map Provided by JNCC",
"maxZoom": 18,
"center": [
  -3.507729,
  52.304535
],
"zoom": 6,
"baseLayers": [
  {
    "baseLayerId": 9,
    "name": "World1 (Test)",
    "attribution": "Data derived from OpenStreetMap",
    "attributionUrl": "http://openstreetmap.org",
    "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
    "layerName": "simplified_land_polygons",
    "visible": false
  },
  {
    "baseLayerId": 10,
    "name": "World2 (Test)",
    "attribution": "Data derived from OpenStreetMap",
    "attributionUrl": "http://openstreetmap.org",
    "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
    "layerName": "simplified_land_polygons_alt",
    "visible": true
  }
],
"externalWmsUrls": [
  {
    "externalWmsUrlId": 28,
    "name": "EMODnet Biology (Test)",
    "description": "EMODnet Biology",
    "url": "http://geo.vliz.be/geoserver/wms",
    "mapInstanceId": 7
  },
  {
    "externalWmsUrlId": 29,
    "name": "EMODnet Geology (Test)",
    "description": "EMODnet Geology",
    "url": "http://drive.emodnet-geology.eu/geoserver/EMODnetGeology/wms",
    "mapInstanceId": 7
  },
  {
    "externalWmsUrlId": 30,
    "name": "EMODnet Human Activities (Test)",
    "description": "EMODnet Human Activities",
    "url": "http://77.246.172.208/geoserver/emodnet/wms",
    "mapInstanceId": 7
  }
],
"layerGroups": [
  {
    "layerGroupId": 82,
    "name": "EMODnet broad-scale seabed habitat map for Europe (EUSeaMap) (Test)",
    "description": "<p>Collection of <strong>Layers</strong></p>",
    "order": 10,
    "isExternal": false,
    "mapInstanceId": 7,
    "layers": [
      {
        "layerId": 187,
        "name": "EUNIS/full-detail habitat classification (Test)",
        "metadataDescription": "Broad-scale seabed habitat map for all European waters. Classified in EUNIS classification system, except where translation is not possible.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/02a444c8-bd2d-4e15-8e69-806059103760",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": null,
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "eusm2016",
        "legendLayerName": "eusm2016_full",
        "layerGroupId": 82,
        "filters": [
          {
            "filterId": 176,
            "name": "Eunis Habitat (Test)",
            "description": "<p>Filter by <strong>Eunis</strong> Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "hab_type",
            "lookupCategory": "EunisHabitats",
            "isComplex": false,
            "layerId": 187
          }
        ],
        "order": 10,
        "visible": true,
        "opacity": 0.8,
        "center": [
          -3.507729,
          52.304535
        ],
        "zoom": 6
      },
      {
        "layerId": 188,
        "name": "MSFD Benthic Broad Habitat Types (Test)",
        "metadataDescription": "Broad-scale seabed habitat map for all European waters. Classified into Marine Strategy Framework Directive Benthic Broad Habitat Types.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/d23d0516-6ff4-4fb8-bf78-c11991cef78b",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": null,
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "eusm_msfd",
        "legendLayerName": "eusm2016_msfd_full",
        "layerGroupId": 82,
        "filters": [
          {
            "filterId": 178,
            "name": "Ospar Habitat (Test)",
            "description": "<p>Filter by <strong>Ospar</strong> Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "hab_type",
            "lookupCategory": "OsparHabitats",
            "isComplex": false,
            "layerId": 188
          },
          {
            "filterId": 179,
            "name": "Habitat (Test)",
            "description": "<p>Filter by Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "habitat",
            "lookupCategory": "Habitat",
            "isComplex": false,
            "layerId": 188
          },
          {
            "filterId": 177,
            "name": "Eunis Habitat (Test)",
            "description": "<p>Filter by <strong>Eunis</strong> Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "hab_type",
            "lookupCategory": "EunisHabitats",
            "isComplex": false,
            "layerId": 188
          }
        ],
        "order": 11,
        "visible": false,
        "opacity": 0.8,
        "center": [
          -3.507729,
          52.304535
        ],
        "zoom": 6
      },
      {
        "layerId": 189,
        "name": "Substrate type (Test)",
        "metadataDescription": "Classified biological zones for all European waters. One of several habitat descriptors used to determine the final habitat type.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/ad20fbc7-37d4-40b5-a246-8cdb321e4654",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": "Classified habitat descriptors",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "eusm_bio",
        "legendLayerName": "eusm2016_bio_full",
        "layerGroupId": 82,
        "filters": [],
        "order": 12,
        "visible": false,
        "opacity": 0.8,
        "center": [
          -3.507729,
          52.304535
        ],
        "zoom": 6
      }
    ]
  },
  {
    "layerGroupId": 83,
    "name": "Environmental variables that influence habitat type (Test)",
    "description": "<p>Collection of <strong>Layers</strong></p>",
    "order": 20,
    "isExternal": false,
    "mapInstanceId": 7,
    "layers": [
      {
        "layerId": 190,
        "name": "Substrate type (Test)",
        "metadataDescription": "Classified seabed substrate types for all European waters. One of several habitat descriptors used to determine the final habitat type. Based on the EMODnet Geology seabed substrate product.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/15adae05-99f0-4275-88c3-26d7908b9f0e",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": "Classified habitat descriptors",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "eusm_sub",
        "legendLayerName": "eusm2016_subs_full",
        "layerGroupId": 83,
        "filters": [],
        "order": 13,
        "visible": false,
        "opacity": 0.8,
        "center": [
          -3.507729,
          52.304535
        ],
        "zoom": 6
      },
      {
        "layerId": 192,
        "name": "EUSeaMap 2016 Oxygen Regime Group (Test)",
        "metadataDescription": "Description",
        "metadataUrl": "#",
        "downloadURL": "#",
        "subLayerGroup": "Regional broad-scale seabed habitat maps",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "eusm_oxy",
        "legendLayerName": "eusm2016_oxy_full",
        "layerGroupId": 83,
        "filters": [],
        "order": 21,
        "visible": false,
        "opacity": 0.8,
        "center": [
          36,
          43
        ],
        "zoom": 7
      }
    ]
  },
  {
    "layerGroupId": 84,
    "name": "Collection of Layers (Test)",
    "description": "<p>Collection of <strong>Layers</strong></p>",
    "order": 30,
    "isExternal": false,
    "mapInstanceId": 7,
    "layers": [
      {
        "layerId": 191,
        "name": "EUNIS classification for the UK shelf area at 3 arc-second resolution (Test)",
        "metadataDescription": "Case-study in the use of the \"EUSeaMap\" model to drive a higher resolution three arc-second broad-scale habitat map for the UK shelf where sufficient data are available.",
        "metadataUrl": "",
        "downloadURL": "",
        "subLayerGroup": "Regional broad-scale seabed habitat maps",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "uksm2016",
        "legendLayerName": "uk3as",
        "layerGroupId": 84,
        "filters": [
          {
            "filterId": 182,
            "name": "Species (Test)",
            "description": "<p>Filter by Species Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "species",
            "lookupCategory": "Species",
            "isComplex": false,
            "layerId": 191
          },
          {
            "filterId": 183,
            "name": "Habitat (Test)",
            "description": "<p>Filter by Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "habitat",
            "lookupCategory": "Habitat",
            "isComplex": false,
            "layerId": 191
          }
        ],
        "order": 21,
        "visible": false,
        "opacity": 0.8,
        "center": [
          -3.507729,
          52.304535
        ],
        "zoom": 6
      },
      {
        "layerId": 193,
        "name": "Test Layer with Complex Filters (Test)",
        "metadataDescription": "Broad-scale seabed habitat map for all European waters. Classified in EUNIS classification system, except where translation is not possible.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/02a444c8-bd2d-4e15-8e69-806059103760",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": "",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "Test",
        "legendLayerName": "eusm2016_full",
        "layerGroupId": 84,
        "filters": [
          {
            "filterId": 181,
            "name": "Habitat Code (Test)",
            "description": "<p>Filter by Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "text",
            "attribute": "code",
            "lookupCategory": null,
            "isComplex": true,
            "layerId": 193
          },
          {
            "filterId": 180,
            "name": "Habitat (Test)",
            "description": "<p>Filter by Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "code",
            "lookupCategory": "EunisHabitats",
            "isComplex": true,
            "layerId": 193
          }
        ],
        "order": 22,
        "visible": false,
        "opacity": 0.8,
        "center": [
          36,
          43
        ],
        "zoom": 7
      },
      {
        "layerId": 194,
        "name": "Test Layer with Complex Filters(2) (Test)",
        "metadataDescription": "Broad-scale seabed habitat map for all European waters. Classified in EUNIS classification system, except where translation is not possible.",
        "metadataUrl": "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/02a444c8-bd2d-4e15-8e69-806059103760",
        "downloadURL": "http://www.emodnet-seabedhabitats.eu/access-data/download-data/?linkid=1",
        "subLayerGroup": "",
        "url": "//jnccdev-geo.esdm.co.uk/geoserver/emodnet/wms",
        "layerName": "Test1",
        "legendLayerName": "eusm2016_full",
        "layerGroupId": 84,
        "filters": [
          {
            "filterId": 184,
            "name": "Habitat (Test)",
            "description": "<p>Filter by Habitat Classifications</p>",
            "metadataUrl": "",
            "type": "lookup",
            "attribute": "code",
            "lookupCategory": "EunisHabitats",
            "isComplex": true,
            "layerId": 194
          },
          {
            "filterId": 185,
            "name": "Substrate (Test)",
            "description": "<p>Filter by Substrate</p>",
            "metadataUrl": "",
            "type": "text",
            "attribute": "substrate",
            "lookupCategory": null,
            "isComplex": true,
            "layerId": 194
          }
        ],
        "order": 23,
        "visible": false,
        "opacity": 0.8,
        "center": [
          37,
          44
        ],
        "zoom": 7
      }
    ]
  },
  {
    "layerGroupId": 85,
    "name": "External Layers (Test)",
    "description": "<p>Add Layers from <strong>External Sources</strong></p>",
    "order": 999,
    "isExternal": true,
    "mapInstanceId": 7,
    "layers": [
      {
        "layerId": 195,
        "name": "EMODnet Human Activity - Lighthouses (Test)",
        "metadataDescription": "",
        "metadataUrl": "",
        "downloadURL": "",
        "subLayerGroup": "",
        "url": "http://geo.vliz.be/geoserver/wms?version=1.1.1",
        "layerName": "lighthouses",
        "legendLayerName": "lighthouses",
        "layerGroupId": 85,
        "filters": [],
        "order": 1,
        "visible": false,
        "opacity": 0.8,
        "center": [
          37,
          44
        ],
        "zoom": 7
      }
    ]
  }
]
}

Return a list of Lookup categories:

http://jnccdev-api.esdm.co.uk/api/Lookup

click to see example JSON output

[
  "Habitat",
  "Species"
]

Return a list of Lookups in a particular Category:

http://jnccdev-api.esdm.co.uk/api/lookup/habitat

click to see example JSON output

[
  {
    "lookupId": 7,
    "code": "HB0",
    "name": "Habitat 0",
    "lookupCategory": "Habitat"
  },
  {
    "lookupId": 8,
    "code": "HB1",
    "name": "Habitat 1",
    "lookupCategory": "Habitat"
  },
  {
    "lookupId": 9,
    "code": "HB2",
    "name": "Habitat 2",
    "lookupCategory": "Habitat"
  },
  {
    "lookupId": 10,
    "code": "HB3",
    "name": "Habitat 3",
    "lookupCategory": "Habitat"
  },
  {
    "lookupId": 11,
    "code": "HB4",
    "name": "Habitat 4",
    "lookupCategory": "Habitat"
  },
  {
    "lookupId": 12,
    "code": "HB5",
    "name": "Habitat 5",
    "lookupCategory": "Habitat"
  }
]

Gazetteer Lookup

Looks up place names that starts with a string: http://jnccdev-api.esdm.co.uk/api/gazetteer/po

click to see example JSON output

[
{
  "gazetteerId": 237,
  "name": "Polish Exclusive Economic Zone",
  "category": "EEZ",
  "extent": [
    14.201402,
    19.80486,
    52.653519,
    55.92155
  ]
},
{
  "gazetteerId": 194,
  "name": "Portuguese Exclusive Economic Zone (Azores)",
  "category": "EEZ",
  "extent": [
    -35.585581,
    -20.599166,
    33.586358,
    43.064826
  ]
},
{
  "gazetteerId": 198,
  "name": "Portuguese Exclusive Economic Zone (Madeira)",
  "category": "EEZ",
  "extent": [
    -21.2245,
    -12.590454,
    29.247847,
    36.469743
  ]
},
{
  "gazetteerId": 199,
  "name": "Portuguese Exclusive Economic Zone",
  "category": "EEZ",
  "extent": [
    -13.86535,
    -7.256941,
    34.877599,
    42.05467
  ]
}
]

Database fields and conversion to JSON

For the /api/mapInstance/{name} and /api/MapId/{id} endpoints, some of the field names in the 'MapInstance' and 'Layer' database tables are converted or re-mapped into JSON Array fields.

In MapInstance:

public double MapCentreLon = -3.507729,
public double MapCentreLat = 52.304535

becomes an array in the JSON response:

"center": [
   -3.507729,
   52.304535
]

Also in Layer:

public double LayerCentreLon = -3.507729,
public double LayerCentreLat = 52.304535

becomes an array in the JSON response:

"center": [
   -3.507729,
   52.304535
]

In the Gazeteer

public double Xmin=-3.9021790028,
public double Ymin=52.1505680545,
public double Xmax=-3.1489288807,
public double Ymax=52.4495366603

becomes an array in the JSON response:

"extent": [
  -3.9021790028,
  52.1505680545,
  -3.1489288807,
  52.4495366603
]

Other database fields that are mapped with no conversion:

MapInstance:

Database Field Name JSON field name
MapZoom zoom

Layer:

Database Field Name JSON field name
LayerOrder order
LayerVisible visible
LayerOpacity opacity
LayerZoom zoom