Layers

List the layers in a viewer

GET /maps_api/v2/server/viewers/(string: identifier)/layers

Get a list of layers in a viewer.

Parameters:
  • identifier (string) – Identifier of the viewer.

Example request:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false,
    "layers": [
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/24",
            "id": 24,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "OSM",
            "type": "osm",
            "base": true,
            "consultable": false,
            "sort_order": 0,
            "created_at": "2017-03-20T11:34:30+01:00",
            "updated_at": "2017-03-20T11:34:30+01:00"
        },
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/26",
            "id": 26,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "Luchtfoto",
            "type": "aerial",
            "base": true,
            "consultable": false,
            "sort_order": 1,
            "created_at": "2017-03-20T11:34:37+01:00",
            "updated_at": "2017-03-20T11:34:37+01:00"
        },
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198",
            "id": 198,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "testkaart",
            "type": "vector",
            "base": false,
            "consultable": true,
            "sort_order": 2,
            "vector_source": {
                "has_sld": false,
                "type": "polygon",
                "uploadable": true,
                "drawable": true,
                "created_at": "2018-04-03T11:31:12+02:00",
                "updated_at": "2018-04-03T11:31:12+02:00"
            },
            "created_at": "2018-04-03T11:31:12+02:00",
            "updated_at": "2018-04-03T11:31:12+02:00"
        }
    ]
}

Sort the layers in a viewer

POST /maps_api/v2/server/viewers/(string: identifier)/sort_layers

Sort one or more layers of a viewer. You may either position a single layer to a new position, or send multiple sorting locations in one go. When sorting layers, it is not required to sort all at once, layers not sent with the request will be re-ordered according to the layers that have been sent. This call will return a list of all layers to indicate the new state of all layers in the viewer. This request may either be sent with a JSON body or a form url-encoded body. You must specify the Content-Type header.

Parameters:
  • identifier (string) – Identifier of the viewer.
Request JSON Object:
 
  • id (int) – The id of the layer for which to change the sorting if only a single layer is being sorted. See the examples below.
  • sort_order (int) – The new position of the layer if only a single layer is being sorted. See the examples below.
  • layers (object[]) – If multiple layers are being sorted, they need to be sent using the layers key. See the examples below.

Example JSON requests:

When sorting a single layer:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "id": 24,
    "sort_order": 1
}

When sorting multiple layers at once:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "layers": [
        {"id": 24, "sort_order": 1},
        {"id": 26, "sort_order": 0}
    ]
}

Example form requests:

When sorting a single layer:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

id=24&sort_order=1

When sorting multiple layers at once:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

layers%5B0%5D%5Bid%5D=24&layers%5B0%5D%5Bsort_order%5D=1&layers%5B1%5D%5Bid%5D=26&layers%5B1%5D%5Bsort_order%5D=0

Example response:

{
    "error": false,
    "layers": [
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/26",
            "id": 26,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "Luchtfoto",
            "type": "aerial",
            "base": true,
            "consultable": false,
            "sort_order": 0,
            "created_at": "2017-03-20T11:34:37+01:00",
            "updated_at": "2017-03-20T11:34:37+01:00"
        },
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/24",
            "id": 24,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "OSM",
            "type": "osm",
            "base": true,
            "consultable": false,
            "sort_order": 1,
            "created_at": "2017-03-20T11:34:30+01:00",
            "updated_at": "2017-03-20T11:34:30+01:00"
        },
        {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198",
            "id": 198,
            "viewer": {
                "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "name": "Testkaart",
                "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
                "created_at": "2018-04-03T11:30:44+02:00",
                "updated_at": "2018-04-03T11:36:03+02:00"
            },
            "name": "testkaart",
            "type": "vector",
            "base": false,
            "consultable": true,
            "sort_order": 2,
            "vector_source": {
                "has_sld": false,
                "type": "polygon",
                "uploadable": true,
                "drawable": true,
                "created_at": "2018-04-03T11:31:12+02:00",
                "updated_at": "2018-04-03T11:31:12+02:00"
            },
            "created_at": "2018-04-03T11:31:12+02:00",
            "updated_at": "2018-04-03T11:31:12+02:00"
        }
    ]
}

Create a new layer for a viewer

POST /maps_api/v2/server/viewers/(string: identifier)/layers

Create a new layer in a viewer. This request may either be sent with a JSON body or a form url-encoded body. You must specify the Content-Type header. See the examples for some usage.

Parameters:
  • identifier (string) – Identifier of the viewer.
Request JSON Object:
 
  • name (string) – The name of the layer.
  • type (string) – See GET /maps_api/v2/server/layer_types for a list of possible layer types. This should contain one of the values specified.
  • base (boolean) – Whether the layer should be a base layers. See the Maps API introduction and glossary for more details. This field is optional, by default it is false.
  • consultable (boolean) – Whether the layer should be consultable (i.e. feature information should be exposed to the user. Note that not sources have feature information (e.g. the aerial layer has no feature information). This field is optional, by default it is true.
  • outline_target_viewer (string) – Only for outline layers: Identifier of the target viewer for which to show the outline. The target viewer must be within the same application as the current viewer.
  • outline_clickable (boolean) – Only for outline layers: Whether a click on the outline polygon within the viewer will result in a redirect to the target viewer. This will only redirect the current frame context to this new viewer.
  • proxy_target_layer (integer) – Only for proxy layers: Identifier of the target layer to proxy. The target layer must be of a viewer of the same application as the current viewer, and may not be of the same viewer. The target layer may not be a proxy layer. A proxy layer will not be rendered when proxied by a proxy layer.
  • vector_uploadable (boolean) – Only for vector layers: Whether uploading should be allowed for this layer. This field is optional, by default it is true.
  • vector_drawable (boolean) – Only for vector layers: Whether the editor should be enabled for this layer. This field is optional, by default it is false.
  • vector_type (string) – Only for vector layers: The type of geometry uploaded to this layer. By default this is a polygon layer. For a list of possible types see GET /maps_api/v2/server/vector_source_types.
  • wfs_url (string) – Only for wfs layers: The URL of the WFS service.
  • wfs_layer_name (string) – Only for wfs layers: The name of the layer to use from the WFS service.
  • wms_url (string) – Only for wms layers: The URL of the WMS service.
  • wms_layer_name (string) – Only for wms layers: The name of the layer to use from the WMS service.

Example JSON request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "name": "Vector",
    "type": "vector",
    "vector_drawable": true
}

Example form request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

name=Vector&type=vector&vector_drawable=true

Example response:

{
    "layer": {
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.test/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "name": "Testkaart",
            "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae"
        },
        "name": "Vector",
        "type": "vector",
        "base": false,
        "consultable": false,
        "sort_order": 4,
        "vector_source": {
            "has_sld": false,
            "type": "polygon",
            "uploadable": false,
            "drawable": false,
            "created_at": "2018-08-15T15:07:58+02:00",
            "updated_at": "2018-08-15T15:07:58+02:00"
        },
        "created_at": "2018-08-15T15:07:58+02:00",
        "updated_at": "2018-08-15T15:07:58+02:00"
    },
    "error": false
}

Upload a new vector layer for a viewer

POST /maps_api/v2/server/viewers/(string: identifier)/upload

Upload a shapefile and use the data from that shapefile to create a new vector layer. The request may either be sent with a JSON body or a form multipart upload. You must specify the Content-Type header.

Parameters:
  • identifier (string) – Identifier of the viewer.
Request JSON Object:
 
  • layer_name (string) – The name of the layer if it should not be derived from the name of the file. Optional, if not provided the name of the file will be used instead.
  • type (string) – The type of the geometries to be inserted into the layer. For a list of options, see GET /maps_api/v2/server/vector_source_types.
  • file (file) – The shapefile itself. See the example below for usage within JSON.

Example JSON request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "type": "polygon",
    "file": {
        "name": "Vector.zip",
        "content": "Base64-encoded content"
    }
}

Example form request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: multipart/form-data; boundary=--BOUNDARY--

--BOUNDARY--
Content-Disposition: form-data; name="file"; filename="Vector.zip"

[Vector.zip content]
--BOUNDARY--
Content-Disposition: form-data; name="type"

polygon
--BOUNDARY--

Example response:

{
    "features": 192,
    "layer": {
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.test/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "name": "Testkaart",
            "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae"
        },
        "name": "Vector",
        "type": "vector",
        "base": false,
        "consultable": false,
        "sort_order": 4,
        "vector_source": {
            "has_sld": false,
            "type": "polygon",
            "uploadable": false,
            "drawable": false,
            "created_at": "2018-08-15T15:07:58+02:00",
            "updated_at": "2018-08-15T15:07:58+02:00"
        },
        "created_at": "2018-08-15T15:07:58+02:00",
        "updated_at": "2018-08-15T15:07:58+02:00"
    },
    "error": false
}

Get a layer’s details

GET /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)

Get the detailed information about a layer in some viewer.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.

Example request:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220 HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "layer": {
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.test/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "name": "Testkaart",
            "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae"
        },
        "name": "Vector",
        "type": "vector",
        "base": false,
        "consultable": false,
        "sort_order": 4,
        "vector_source": {
            "has_sld": false,
            "type": "polygon",
            "uploadable": false,
            "drawable": false,
            "created_at": "2018-08-15T15:07:58+02:00",
            "updated_at": "2018-08-15T15:07:58+02:00"
        },
        "created_at": "2018-08-15T15:07:58+02:00",
        "updated_at": "2018-08-15T15:07:58+02:00"
    },
    "error": false
}

Update a layer’s details

PATCH /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)

Update the details of an existing layer. Alternatively you can use the POST or PUT http methods, but you will need to specify all form fields, including the ones that did not change in that case. This request may either be sent with a JSON body or a form url-encoded body. You must specify the Content-Type header. See the examples for some usage.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
Request JSON Object:
 
  • name (string) – Optional: The new name of the layer.
  • type (string) – Optional: See GET /maps_api/v2/server/layer_types for a list of possible layer types. This should contain one of the values specified. Note that if the layer is currently of type wms, wfs or vector you cannot change the type of the layer anymore.
  • base (boolean) – Optional: Whether the layer should be a base layers. See the Maps API introduction and glossary for more details.
  • consultable (boolean) – Optional: Whether the layer should be consultable (i.e. feature information should be exposed to the user. Note that not sources have feature information (e.g. the aerial layer has no feature information).
  • outline_target_viewer (string) – Only for outline layers: Identifier of the target viewer for which to show the outline. The target viewer must be within the same application as the current viewer.
  • outline_clickable (boolean) – Only for outline layers: Whether a click on the outline polygon within the viewer will result in a redirect to the target viewer. This will only redirect the current frame context to this new viewer.
  • proxy_target_layer (integer) – Only for proxy layers: Identifier of the target layer to proxy. The target layer must be of a viewer of the same application as the current viewer, and may not be of the same viewer. The target layer may not be a proxy layer. A proxy layer will not be rendered when proxied by a proxy layer.
  • vector_uploadable (boolean) – Optional: Only for vector layers: Whether uploading should be allowed for this layer.
  • vector_drawable (boolean) – Optional: Only for vector layers: Whether the editor should be enabled for this layer.
  • vector_type (string) – Optional: Only for vector layers: The type of geometry uploaded to this layer. For a list of possible types see GET /maps_api/v2/server/vector_source_types.
  • wfs_url (string) – Optional: Only for wfs layers: The URL of the WFS service.
  • wfs_layer_name (string) – Optional: Only for wfs layers: The name of the layer to use from the WFS service.
  • wms_url (string) – Optional: Only for wms layers: The URL of the WMS service.
  • wms_layer_name (string) – Optional: Only for wms layers: The name of the layer to use from the WMS service.

Example JSON request:

PATCH /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220 HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "name": "Vector - updated"
}

Example form request:

PATCH /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220 HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

name=Vector%20-%20updated

Example response:

{
    "layer": {
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.test/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "name": "Testkaart",
            "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae"
        },
        "name": "Vector - updated",
        "type": "vector",
        "base": false,
        "consultable": false,
        "sort_order": 4,
        "vector_source": {
            "has_sld": false,
            "type": "polygon",
            "uploadable": false,
            "drawable": false,
            "created_at": "2018-08-15T15:07:58+02:00",
            "updated_at": "2018-08-15T15:07:58+02:00"
        },
        "created_at": "2018-08-15T15:07:58+02:00",
        "updated_at": "2018-08-15T15:07:58+02:00"
    },
    "error": false
}

Delete a layer

DELETE /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/delete

Delete a layer.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.

Example request:

DELETE /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false
}

Get the feature data for a vector layer

GET /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/features

This call allows you to retrieve the feature data, either with or without geometries. The returned data can be formatted using several different file formats. Optionally, the format may be specified using a .(csv|gml|json) postfix at the end of the url. Note however that the Accept header and format query parameter will override this. If no format is specified, a JSON (GeoJSON) file will be returned.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
  • identifier – Identifier of the viewer.
Query Parameters:
 
  • format (string) – Optional. If this is specified, this will override the format specified in the Accept header. Allowed values are: csv, gml and json (or geojson).
  • geometry (boolean) – Optional. If true, then the geometry will be included in the output, otherwise the geometry will not be included (which is also the default).
Request Headers:
 
  • Accept – The returned file will have the format specified by this header, unless a format was specified using the format query parameter. Accepted values are: text/csv, application/gml+xml (or alternatively text/xml and application/json.

Upload the SLD for a vector layer

POST /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/sld/upload

Upload a new SLD for a vector layer. Note that the layer must be of type vector for this call to work. This request may either be sent with a JSON body or a form url-encoded body. You must specify the Content-Type header.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
Request JSON Object:
 
  • file – The file should be uploaded using the file property.

Example JSON request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "file": {
        "name": "example.sld",
        "content": "Base64-encoded content"
    }
}

Example form request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: multipart/form-data; boundary=--BOUNDARY--

--BOUNDARY--
Content-Disposition: form-data; name="file"; filename="example.sld"

[example.sld content]
--BOUNDARY--

Example response:

{
    "error": false
}

Remove the SLD for a vector layer

DELETE /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/sld/delete

Delete the SLD for a vector layer. Note that the type of the layer must be vector for this call to work, it will not work with any other layer type.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.

Example request:

DELETE /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false
}

Check if a vector layer SLD exists

GET /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/sld

Returns a boolean indicating if this vector layer has an SLD attached. Note that the layer type must be vector for this call to work, it won’t work on any other layer type.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.

Example request:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false,
    "sld": true
}

Upload new data for an existing vector layer

POST /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/upload

Replace the existing data of a vector layer with new data from an uploaded shapefile. Note that the layer type must be vector and that the vector layer must allow uploading for this to work. This request may either be sent with a JSON body or a form url-encoded body. You must specify the Content-Type header.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
Request JSON Object:
 
  • type (string) – Optional: The type of the geometries to be inserted into the layer. By default this will keep its previous value. For a list of options, see GET /maps_api/v2/server/vector_source_types.
  • file (file) – The shapefile itself. See the example below for usage within JSON.

Example JSON request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: application/json

{
    "file": {
        "name": "Vector.zip",
        "content": "Base64-encoded content"
    }
}

Example form request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload HTTP/1.1
Host: planviewer.nl
Accept: application/json
Content-Type: multipart/form-data; boundary=--BOUNDARY--

--BOUNDARY--
Content-Disposition: form-data; name="file"; filename="Vector.zip"

[Vector.zip content]
--BOUNDARY--

Example response:

{
    "features": 192,
    "error": false
}