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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/24",
            "id": 24,
            "viewer": {
                "self_url": "https://www.planviewer.nl/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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/26",
            "id": 26,
            "viewer": {
                "self_url": "https://www.planviewer.nl/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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198",
            "id": 198,
            "viewer": {
                "self_url": "https://www.planviewer.nl/maps_api/v2/server/vieweshop/payment/overview.html.twigrs/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.shop/payment/overview.html.twig

Note

Default the layers are sorted as followed: Starting from 1 the base layers are numbered. The next layer (usually the outline layer (Dossiergrens)) will have number 5 And so on. You can find the current sorting by using List the layers in a viewer

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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/26",
            "id": 26,
            "viewer": {
                "self_url": "https://www.planviewer.nl/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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/24",
            "id": 24,
            "viewer": {
                "self_url": "https://www.planviewer.nl/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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198",
            "id": 198,
            "viewer": {
                "self_url": "https://www.planviewer.nl/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.
  • show_layer (boolean) – A boolean value to either show (true) or not show (false) when loading the viewer. Layer will remain available in the viewer and can be manually turned on.
  • 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.
  • use_transparancy (boolean) – Wether a layer had a transparency slider and should react to that. Only works on non base layers. This field is optional, its default value is false.;
  • 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.
  • as_wms (boolean) – Only for vector layers. Displays layer in the viewer as a WMS layer. Set to true when using complex geometries (or a lot of them). It will greatly increase the loading speed of the viewer.
  • 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.
  • wmts_url (string) – Only for wmts layers: The URL of the WMTS service.
  • wmts_layer_name (string) – Only for wmts layers: The name of the layer to use from the WMTS service.
  • filter_fields (array) – an array of feature fields you want to show/hide when retrieving feature information in the viewer.
  • translations (array) – an array of feature fields and their translation for fields you want to translate when showing feature information.
  • min_zoom (array) – The minimal zoom needed for the layer to be visible.
  • max_zoom (array) – The maximal zoom needed for the layer to be visible.
Trouble figuring out how to configure your Json request?
Take a look at our examples per layer type.
For an explanation of filter_fields and translations

Upload a new vector layer for a viewer

For uploading a shapefile , a valid shapefile must be created with programs like QGis. See definition: https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf.

Note

This function has been deprecated. Please use the shape file import.

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. When uploading with JSON, the contents of the complete zip file must be base64 encoded. This output must be used as content parameter.

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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.nl/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.nl/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.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "delete_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/delete",
        "update_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220",
        "features_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/features",
        "upload_sld_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/upload",
        "remove_sld_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sld/delete",
        "upload_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/upload",
        "create_mapping_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "mappings_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/mappings",
        "sort_mappings_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/sort_mappings",
        "editor_embed_url": "https://www.planviewer.nl/maps_api/v2/embed/editor/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/220",
        "id": 220,
        "viewer": {
            "self_url": "https://www.planviewer.nl/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.

Warning

Although it is posible to change the layer type, it is not advisable to do so. This could result in a defective viewer.

See Creating & updating layers

Add banner to layer Info Block

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

Per layer it is possible to add a banner-image plus url after a key-value block. In this example we use the ‘Kadastrale grenzen’ layer.

param string identifier:
 Identifier of the viewer.
param int layer:
 Id of the layer.

Example JSON request:

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

{
    "name": "perceelnummer",
    "url":"htps://www.yourUrl",
    "image": "Base64-encoded you image"
}

The following image formats are supported:

  • JPG
  • PNG
  • SVG
  • GIF

Note

Only one banner is supported per layer. If you upload a new image for a layer the old one is replaced.

Delete banner to layer Info Block

PATCH /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/banner
Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.

Example JSON request:

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

{
    "delete": true,
}

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.
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).
  • id (integer) – Optional. filter feature by id. Use this when accessing large vector layers to retrieve geometry data.
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
}

Get the legend for a layer

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

Returns a layer’s classnames and icons.

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

Note

this function is only available for layers of type: “vector”

Example request:

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

Example response:

{
    "mijn-kaartlaag": [
        {
            "name": "Bos",
            "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEV8qXw9lz0AtgBgIlnIAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg==",
            "image": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEV8qXw9lz0AtgBgIlnIAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg=="
        },
        {
            "name": "Rietland",
            "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEWnroeSolGtyyljNGyEAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg==",
            "image": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEWnroeSolGtyyljNGyEAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg=="
        },
        {
            "name": "Haag",
            "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEV8l3w9cz0AbQBP/WVMAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg==",
            "image": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEV8l3w9cz0AbQBP/WVMAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg=="
        },
        {
            "name": "Water",
            "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEWNjbxeX7xCRf8z43bbAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg==",
            "image": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEWNjbxeX7xCRf8z43bbAAAAK0lEQVRIiWMQDcUOQhiyVmEHK0dlRmVGZUZlRmVGZUZlRmVGZYaNDM7WIAABplKFBCjKqAAAAABJRU5ErkJggg=="
        },
    ],
    "error": false
}

Add feature info and a geometry to a vector layer

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

Adds a geometry to a vector layer and add it’s features

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
  • geometry (string) – geometry
  • properties (object) – Features for the geometry

Note

this function is only available for layers of type: “vector”

Example request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/legenda HTTP/1.1
Host: planviewer.nl
Accept: application/json
{
    "geometry": "Polygon ((190007.34200000000419095 444029.18800000002374873, 190007.63500000000931323 444029.96199999999953434, 190017.09099999998579733 444052.92599999997764826, 190017.20000000001164153 444052.87699999997857958, 190030.9370000000053551 444047.71500000002561137, 190035.43900000001303852 444046.09399999998277053, 190031.50399999998626299 444034.06900000001769513, 190026.35899999999674037 444019.62900000001536682, 190007.34200000000419095 444029.18800000002374873))",
    "properties": {
        "color": "red",
        "gebied": "alpha"
    }
}

Example response:

{
        "error": false,
        "message": "feature information added to layer",
        "featureId": 20015
}

it is also posible to add multiple at the same time. to do this added geometry’s and properties to aan array called multiple.

Example request multiple:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/legenda HTTP/1.1
Host: planviewer.nl
Accept: application/json
{
    "multiple": [
        {
            "geometry": "Polygon ((190007.34200000000419095 444029.18800000002374873, 190007.63500000000931323 444029.96199999999953434, 190017.09099999998579733 444052.92599999997764826, 190017.20000000001164153 444052.87699999997857958, 190030.9370000000053551 444047.71500000002561137, 190035.43900000001303852 444046.09399999998277053, 190031.50399999998626299 444034.06900000001769513, 190026.35899999999674037 444019.62900000001536682, 190007.34200000000419095 444029.18800000002374873))",
            "properties": {
                "color": "red",
                "gebied": "alpha"
            }
        },
        {
            "geometry": "Polygon ((190029.48000000001047738 444061.00900000002002344, 190023.78599999999278225 444063.13400000002002344, 190015.95900000000256114 444066.16200000001117587, 190010.64799999998649582 444068.4469999999855645, 190013.14600000000791624 444067.80499999999301508, 190014.34799999999813735 444067.78299999999580905, 190015.84899999998742715 444068.16300000000046566, 190016.77400000000488944 444068.44000000000232831, 190017.57000000000698492 444069.36800000001676381, 190017.93299999998998828 444070.15299999999115244, 190018.07399999999324791 444070.52600000001257285, 190016.98300000000745058 444096.19000000000232831, 190017.05799999998998828 444096.19400000001769513, 190016.59299999999348074 444104.90200000000186265, 190016.20900000000256114 444113.66499999997904524, 190015.90499999999883585 444120.35100000002421439, 190015.59200000000419095 444127.22800000000279397, 190015.27999999999883585 444134.09700000000884756, 190014.89600000000791624 444142.52899999998044223, 190014.5089999999909196 444151.04200000001583248, 190014.24600000001373701 444156.8219999999855645, 190013.57300000000395812 444172.86499999999068677, 190013.51300000000628643 444173.4870000000228174, 190013.38200000001234002 444174.09799999999813735, 190013.1810000000114087 444174.69000000000232831, 190012.91200000001117587 444175.25400000001536682, 190012.57999999998719431 444175.78299999999580905, 190011.27700000000186265 444177.22299999999813735, 190010.85300000000279397 444177.55099999997764826, 190010.23600000000442378 444177.83000000001629815, 190023.51600000000325963 444174.29100000002654269, 190026.35999999998603016 444173.72600000002421439, 190025.73399999999674037 444173.55800000001909211, 190025.19299999999930151 444173.28700000001117587, 190024.59500000000116415 444172.84799999999813735, 190024.08999999999650754 444172.33500000002095476, 190023.72200000000884756 444171.81900000001769513, 190023.46400000000721775 444171.24699999997392297, 190023.86100000000442378 444163.2559999999939464, 190024.1879999999946449 444156.66899999999441206, 190024.4409999999916181 444151.5590000000083819, 190024.62599999998928979 444147.89500000001862645, 190025.05100000000675209 444139.4940000000060536, 190025.5089999999909196 444130.4280000000144355, 190025.61300000001210719 444128.375, 190026.61300000001210719 444103.36599999997997656, 190026.86499999999068677 444097.56500000000232831, 190026.98800000001210719 444094.72399999998742715, 190028.08600000001024455 444069.29200000001583248, 190028.13500000000931323 444068.14699999999720603, 190028.27999999999883585 444065.71899999998277053, 190028.71199999999953434 444064.2629999999771826, 190030.5560000000114087 444061.6120000000228174, 190032.68599999998696148 444059.83199999999487773, 190029.48000000001047738 444061.00900000002002344))",
            "properties": {
                "color": "blue",
                "gebied": "alpha"
            }
        }
    ]
}

Example response multiple:

{
    "error": false,
    "message": "feature information added to layer"
}

List all properties and geometry of a vector layer

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

Gets all geometries , it’s id and properties per geometry of a given layer.

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

Note

this function is only available for layers of type: “vector”

Example request:

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

Example response:

{
"id" : "2004",
"geometry": ""SRID=28992;MULTIPOLYGON(((191432.850617455 445495.775797824, 189148.050617455 445119.455797824, 189094.290617455 442243.295797824, 192534.930617455 441759.455797824, 193878.930617455 444098.015797824, 191432.850617455 445495.775797824)),
    ((191432.850617455 445495.775797824, 189148.050617455 445119.455797824, 189094.290617455 442243.295797824, 192534.930617455 441759.455797824, 193878.930617455 444098.015797824, 191432.850617455 445495.775797824)))",
"properties" : {"color": "red", "gebied": "alpha"}
}

Remove properties and geometry of a vector layer

DELETE /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/delete_properties/{int:featureId}

Removes all properties from a feature, based on its id

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

Note

this function is only available for layers of type: “vector”

Example request:

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

Example response:

{"error":false,"message":"Feature was deleted"}

Update properties and the geometry of a vector layer

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

Updates the properties of a vector source , based on its featureId.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Id of the layer.
  • fetaureId (id) – Id of the given feature
  • geometry (string) – geometry
  • properties (object) – Features for the geometry

Note

this function is only available for layers of type: “vector”

Example request:

POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/220/update_feature HTTP/1.1
Host: planviewer.nl
Accept: application/json
{
"featureId": 986,
    "geometry": "MULTIPLOYGON(((191432.850617455 445495.775797824, 189148.050617455 445119.455797824, 189094.290617455 442243.295797824, 192534.930617455 441759.455797824, 193878.930617455 444098.015797824, 191432.850617455 445495.775797824)),
    ((191432.850617455 445495.775797824, 189148.050617455 445119.455797824, 189094.290617455 442243.295797824, 192534.930617455 441759.455797824, 193878.930617455 444098.015797824, 191432.850617455 445495.775797824)))",
"properties" : {"color": "blue", "gebied": "beta"}

    }

Example response:

{"error" => false, "message" => "feature information updated"}

Import a shapefile to vector layer

For uploading a shapefile , a valid shapefile must be created with programs like QGis. See definition: https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf.

Note

This function replaces the upload and update endpoints for creating and updating Vector layers with shapefiles

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

Upload a shapefile and use the data from that shapefile to create a new vector layer.

Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Identifier of the vector layer.
Request JSON Object:
 
  • file (object) –
    <json string name:
     the name of the vector layer
    <json string content:
     The contents of the complete zip file. This must be base64 encoded.

Example JSON request:

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

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

Example response:

{
    "error": false,
    "job_id": 24,
    "status": "scheduled"
}

Tip

After a file has been uploaded it will be imported. this may take a while. Use the same url but with GET to check on the import status

Status imported Shapefile

GET /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/import
Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Identifier of the vector layer.

Example response:

{
    "error": false,
    "job_id": 24,
    "status": "finished"
}

Import a file to imrogml layer

For uploading a gml or zip archive with a gml in the root.

POST /maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/import.gml
Parameters:
  • identifier (string) – Identifier of the viewer.
  • layer (int) – Identifier of the gml layer.
Request JSON Object:
 
  • file (object) –
    <json string name:
     the name of the vector layer
    <json string content:
     The contents of the complete (zip) file. This must be base64 encoded.

Example JSON request:

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

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

Example response:

{
    "error": false,
    "job_id": 24,
    "status": "finished"
}

Note

File size is limited to 90 mb maximum.