-
Notifications
You must be signed in to change notification settings - Fork 1
MP Data Manager API Documentation
This document lays out all API endpoints offered by MP Data Manager.
This endpoint is intended for future development to migrate historic API endpoints into Django's REST Framework.
As of the time of this writing, little work on this has been done, and so this endpoint serves little purpose, but to hint at all of the great features embedded into Django Rest Framework: Open the Endpoint
A simple ViewSet for Layers
- Arguements (query string): format ['json', 'api']
- Allow: GET, HEAD, OPTIONS
- Return: JSON
- Examples:
- HTML: Mid Atlantic Portal
- JSON: Mid Atlantic Portal
Updates the details of a particular layer via POST.
| Argument | Format | Example |
|---|---|---|
| layer_id | string [A-Za-z0-9_-]+
|
3971 |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| status_code | int | 200 |
| success | boolean | True |
| message | string | 'Edited Successfully' |
| layer | JSON object | {...} |
| themes | array | [ {...},{...},...] |
TBH: This doesn't seem to be used anymore.
Create a new layer via POST
| Argument | Format | Example |
|---|---|---|
| url | string | https://coast.noaa.gov/arcgis/rest/services/MarineCadastre/2015VesselTransitCounts_AllVessels/MapServer/ |
| name | string | New Layer |
| layer_type | string | 'ArcREST' |
| themes | array | [0,4,27] |
For 'layer_type' values, please review your local settings for "LAYER_TYPE_CHOICES"
JSON Response:
| Argument | Type | Example |
|---|---|---|
| status_code | int | 200 |
| success | boolean | True |
| message | string | 'Saved Successfully' |
| layer | JSON object | {...} |
| themes | array | [ {...},{...},...] |
Get JSON of all Layers, Themes, and current state via GET
| Argument | Format | Example |
|---|---|---|
| None | N/A | N/A |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| state | JSON Object | {} |
| layers | Array of Objects | [{...},{...},...] |
| themes | Array of Objects | [{...},{...},...] |
| success | boolean | true |
Example: https://portal.midatlanticocean.org/data_manager/get_json
Get JSON of all Themes via GET
Purpose: reduce delay compared to get_json by substantially reducing content size
| Argument | Format | Example |
|---|---|---|
| None | N/A | N/A |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| themes | Array of Objects | [{id:1, name: "administrative", display_name: "Administrative", is_visible: true},{...},...] |
Example: https://portal.midatlanticocean.org/data_manager/get_themes
Get JSON Object of all layers ordered by name to support typeahead search field via get.
| Argument | Format | Example |
|---|---|---|
| None | N/A | N/A |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| [layer_name] | JSON Object | {layer:{id:...,name:...,has_sublayers:...,sublayers:[...]},theme:{id:...,name:...,description:...}} |
Example: https://portal.midatlanticocean.org/data_manager/get_layer_search_data
Provided a Theme ID, retrieve a JSON representation of the Theme's layers via GET
| Argument | Format | Example |
|---|---|---|
| themeID | string | 1 |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| layers | Array of Objects | [{id:...,name:...,type:...,has_sublayers:...,sublayers:[{...}....]},...] |
Example: https://portal.midatlanticocean.org/data_manager/get_layers_for_theme/1
Request a JSON object describing a single layer in detail via GET
| Argument | Format | Example |
|---|---|---|
| layerID | string | 4046 |
JSON Response:
| Argument | Type | Example | Notes |
|---|---|---|---|
| id | int | 4046 | The primary key for the layer |
| uuid | string | "8ce5a282-2586-4885-a5b3-e6bc5d174f00" | A unique ID for the layer |
| name | string | "116th Districts" | The name of the layer |
| order | int | 10 | The relative order the layer should appear under the theme |
| arcgis_layers | int/string/null | "0,12,24" | If layer is ArcREST or ArcFeatureServer, the ID(s) of the layer(s) to pull. If null, 0 is assumed. If multiple, comma separated. |
| query_by_point | boolean | false | Whether to buffer feature requests to get 'close' results. |
| proxy_url | boolean | false | If true, request should go to built-in proxy endpoint to avoid CORS issues. |
| disable_arcgis_attributes | boolean | false | If true, clicking on ArcREST and ArcFeatureServer layers will not query for info |
| wms_slug | string/null | "temp" | A slugified name for the layer |
| wms_version | string/null | 1.3.0 | The version of OGC WMS protocol to use |
| wms_format | string | "image/png" | What data type to expect in return for layer requests |
| wms_srs | string/null | "EPSG:3857" | The projection in which to return data |
| wms_styles | string/null | "boxfill/rainbow" | The name of any WMS-provided styles to apply to results |
| wms_timing | string/null | "2006-06-17T12:00:00.000Z" | The slice of time for which you want to see data |
| wms_time_item | sting/null | "EVENT_TIME" | Time Attribute Field, if different from "TIME". Proxy only. |
| wms_additional | string/null | "&styles=boxfill/rainbow&colorscalerange=3,30&ABOVEMAXCOLOR=transparent&BELOWMINCOLOR=transparent&elevation=-0.9875&autoscalerange=false" | Additional custom query string arguments to be passed to configure requests |
| wms_info | boolean | false | enable Feature Info requests on click |
| wms_info_format | string/null | "test/xml" | Available supported feature info formats |
| utfurl | string/null | null | DEPRECATED: Endpoint for UTF Grid if supported |
| sublayers | array of JSON Objects | [{id:4668,is_sublayer:true,name:"Indigenous Languages"...},...] | Detailed list of sublayers if layer is a parent layer |
| companion_layers | array of JSON Objects | [{id:4888,name:"Unsurveyed area (avian, annual)"...},...] | Detailed list of any associated companion layers |
| has_companion | boolean | false | Presence/absence indicator for companion layers |
| queryable | boolean | false | Select when layers are queryable - e.g. MDAT and CAS |
| legend | string | "http://portal.midatlanticocean.org/static/legends/BroadCoralTiles500m.png" | Location of a static legend image to override any automatic legends |
| legend_title | string | 'Atlantic Mackerel 2007-2020' | Optional override for Legend Title |
| legend_subtitle | string | 'mg Carbon/m<sup>2</sup>/day' |
Optional additional subtitle to place before legend |
| show_legend | boolean | true | Set to false to prevent displaying any legends for the layer |
| description | string | "The purpose of a core abundance area map is to represent the smallest area containing 50% of the predicted abundance of each species. Summing all the cells..." | A description of the layer, it's content, and/or it's methods |
| overview | string | "Coastal waterfowl species include Black scoter, Common eider, Common loon..." | Information about the data displayed in the layer |
| data_source | string | "Marine Life Data and Analysis Team V2" | A text description of where the data came from |
| data_notes | string | 'overview notes revised to v2: 20180816 using http://seamap.env.duke.edu/models/mdat/Avian/MDAT_v2_Avian_Summary_of_Changes.pdf' | Notes about the data |
| kml | string (url) | 'http://ocs-gis.ncd.noaa.gov/maritime_boundaries/USMaritimeLimitsNBoundariesKML.kmz' | Link to data if available as KML |
| data_download | string (url) | "https://seamap.env.duke.edu/models/mdat/#more-information" | Link to download the data, or where the data can be found to download |
| learn_more | string (url) | 'http://seamap.env.duke.edu/models/mdat/' | Link to where a user can learn more about a layer |
| Metadata | string (url) | "http://seamap.env.duke.edu/models/mdat/Avian/MDAT_Avian_Summary_Products_Metadata.pdf" | Link to any metadata that may be available for the layer |
| source | string (url) | "https://seamap.env.duke.edu/models/mdat/" | Link to where the data can be found/explored |
| tiles | string | "coastal-waterfowl-core-abundance-area-mid-atlantic-scale-v2-staging-11041104" | Sluggified layer identifier to display API info for how to include layer in OpenLayers apps |
| label_field | string | "Name" | Which field should be used for labels and feature identification in reports |
| attributes | JSON Object | {compress_attributes:false, event:'click', attributes:[{ display:'...', field:'...', precision:null },...], mouseover_attribute:'', preserved_format_attributes:[]} | Information about any custom attribute reporting for the layer |
| lookups | JSON object | {field:'Type',details:[{value:'...', color:'...', stroke_color:null, stroke_width:null, dashstyle:'solid', fill:true, graphic:null, graphic_scale:null },...]} | Information about any custom cartography to be applied to vector/vector-tile layers |
| minZoom | float | 8.0 | The furthest zoom level out a user should still see this layer rendered |
| maxZoom | float | 17.0 | The furthest zoom level in a user should still see this layer rendered |
| custom_style | string/null | 'color' | Select layers have custom styling this unlocks (Native-Land.ca). 'random' may be used to apply random colors to each feature |
| outline_color | string | '#727371' | Color to be used for rendering stokes for a vector layer with lines or polygons |
| outline_opacity | float | 0.8 | DEPRECATED: Opacity with which to render vector strokes. NOTE: This is not a valid style: fill can have an opacity, otherwise use the layer opacity to style strokes |
| outline_width | int/null | 3 | Vector stroke width |
| point_radius | int/null | 3 | Used only for for rendering Point vector layers |
| color | string/null | "#D5CEF0" | Vector Fill Color |
| fill_opacity | float | 0.8 | Vector fill opacity from 0 to 1 |
| graphic | string/null | "" | Link to an image to use for rendering point data in a vector |
| graphic_scale | int | 1 | How to scale the graphic image rendered for points on a vector layer |
| opacity | float | 0.5 | Layer opacity from 0 to 1 |
| annotated | boolean | false | If true, try to render text labels |
| is_disabled | boolean | false | DEPRECATED: No layers use this, and no logic exists to act on this |
| disabled_message | string/null | null | DEPRECATED: used to alert users about layers temporarily unavailable due to events like government shutdowns -- now we use a site-wide disclaimer |
| data_url | string/null (url) | "/data-catalog/conservation/#layer-info-coastal-waterfowl-core-abundance-area-mid-atlantic-scale-v2-staging-11041104" | Link to view the layer details in built-in data catalog |
| is_multilayer | boolean | false | Indicates if layer is a visible data layer in a slider |
| is_multilayer_parent | boolean | false | Indicates if layer is the primary record for a set of slider layers |
| associated_multilayers | JSON object | {January:{All:5326,Cargo:5338,Passenger:5350,...},...} | Object describing the dimensions used for a slider (multilayer_parent) with node values representing layer ids |
| Catalog_html | string | "\n <div class=\"link-bar\">\n <span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View in Marine Planner\">\n..." |
HTML to display layer as a catalog record |
| parent | JSON object | {id:839,name:"Birds",order:10,...} | Layer details for parent if this layer is a sublayer |
Example: https://portal.midatlanticocean.org/data_manager/get_layer_details/5422
This is used to query a WMS layer for its capabilities to help fill out the admin layer form WMS details.
| Argument | Format | Example |
|---|---|---|
| url (query string) | string (encoded URL) | "https%3A%2F%2Ftds.marine.rutgers.edu%2Fthredds%2Fwms%2Froms%2Fdoppio%2FDopAnV2R3-ini2007_da%2Fmon_ens_means" |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| layers | Array of strings | ["v","h","f","pm",...] |
| formats | Array of strings | ["image/png", "image/png;mode=32bit", "image/gif", ...] |
| version | string | "1.1.1" |
| styles | JSON Object | {v: {boxfill/rainbow: { title: "boxfill/rainbow", legend: "https://tds.marine.rutgers.edu/thredds/wms/roms/doppio/DopAnV2R3-ini2007_da/mon_ens_means?REQUEST=GetLegendGraphic&LAYER=v&PALETTE=rainbow"}, ...} |
| srs | JSON Object | {v:["EPSG:4326","EPSG:3409",...], ...} |
| queryable | Array of strings | ["v","h",...] |
| time | JSON Object | {v:{positions ["\n 2006...",...], default: "2006-12-17T12:00:00.000Z", field: null}, ...} |
| capabilities | JSON Object | {featureInfo: {available: true, formats: ["image/png", "text/xml"]}} |
Request HTML to render a catalog entry for a given layer via GET
| Argument | Format | Example |
|---|---|---|
| layerID | string | 5422 |
JSON Response:
| Argument | Type | Example | Notes |
|---|---|---|---|
| html | string | "\n <div class=\"link-bar\">\n <span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View in Marine Planner\">\n... " |
HTML to render layer as a catalog entry |
Example: https://portal.midatlanticocean.org/data_manager/get_layer_catalog_content/5422/
Retrieve a list of catalog records from a GeoPortal v2 instance of Madrona Portal
| Argument | Format | Example |
|---|---|---|
| None | N/A | N/A |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| records | JSON Object | { 23ef3028380c4262a2777ae4584d607c: {id:"23ef3028380c4262a2777ae4584d607c", title: "Striped Dolphin (Stenella coeruleoalba)" } }, {id: ...}... } |
| record_name_lookup | JSON Object | {"Striped Dolphin (Stenella coeruleoalba)": ["23ef3028380c4262a2777ae4584d607c"] } |
| ELASTISEARCH_INDEX | string | "metadata" |
| CATALOG_TECHNOLOGY | string | "GeoPortal2" |
Example: https://portal.westcoastoceans.org/data_manager/get_catalog_records
Get the modification status of all layers and themes for the portal organized by UUID
| Argument | Format | Example |
|---|---|---|
| None | N/A | N/A |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| themes | JSON Object | { [uuid]: {name: [name], date_modified: [date]}, ...} |
| layers | JSON Object | { [uuid]: {name: [name], date_modified: [date]}, ...} |
Retrieve details for a given list of layers and their themes via POST
| Argument | Format | Example |
|---|---|---|
| layers | Array | [5422, 5409] |
JSON Response:
| Argument | Type | Example |
|---|---|---|
| status | string | "Error" |
| message | string | "Unknown" |
| themes | JSON Object | { [uuid]: {id:1,name:"Administration",order:10,...}, ...} |
| layers | JSON Object | { [uuid]: {id:839,name:"Birds",order:10,...}, ...} |