Server Calls

Server calls are calls made by your server to planviewer.nl.

General

Create a maps api access key, and for all requests in this section provide the user and password as HTTP basic auth parameters. These credentials identify the application for which these requests are made.

ANY https://www.planviewer.nl/maps_api/v1/server
Request Headers:
 
  • Authorization – Base64 user and password separated with ‘:’ as per HTTP standard.

Example request:

Given API acces key 47e7df66f957 and secret cynaivrjre:

POST /maps_api/v1/server/map
Host: planviewer.nl
Accept: application/json
Authorization: Basic NDdlN2RmNjZmOTU3OmN5bmFpdnJqcmU=

Or using curl:

$ curl https://planviewer.nl/maps_api/v1/server/map -u 47e7df66f957:cynaivrjre

Example response:

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}

List the background layers

GET /maps_api/v1/server/background_layers

List the background layers for all viewers in this application. This list may change at any time and should not be cached.

Query Parameters:
 
  • base (boolean) – (optional) Whether or not to retrieve base layers, true by default.
  • overlay (boolean) – (optional) Whether or not to retrieve overlay layers, true by default.

Example request:

POST /maps_api/v1/server/background_layers?base=true&overlay=false
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false,
    "layers": [
        {
            "name": "Luchtfoto",
            "id": 25,
            "base": true
        },
        {
            "name": "OSM",
            "id": 26,
            "base": true
        },
    ]
}

Create a map

POST /maps_api/v1/server/map

Create a map for a given application.

Form Parameters:
 
  • string name – name of the map
  • boolean default_show_print(optional) show the print button in the map viewer
  • boolean default_show_reset(optional) show the reset button in the map viewer
  • boolean default_show_measure(optional) show the measure button in the map viewer
Response JSON Object:
 
  • application_id (integer) – Application to which the map is added.
  • map.identifier (string) – Public identifier of the new map.
  • map.name (string) – Name of the new map.
  • error (boolean) – False if no error occured.

Example request:

POST /maps_api/v1/server/map
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

name=Kaart&default_show_print=true&default_show_reset=true&default_show_measure=true

Example response:

{
    "error": false,
    "application_id": 1,
    "viewer": {
        "identifier": "785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168",
        "name": "Kaart"
    }
}

Update a map

POST /maps_api/v1/server/map/(string: identifier)/update

Update properties for a map.

Parameters:
  • identifier (string) – The identifier as returned by the create call of the server API.
Form Parameters:
 
  • string name(optional) name of the map
  • boolean default_show_print(optional) show the print button in the map viewer
  • boolean default_show_reset(optional) show the reset button in the map viewer
  • boolean default_show_measure(optional) show the measure button in the map viewer
Response JSON Object:
 
  • error (boolean) – False if no error occured.

Example request:

POST /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/update
Host: planviewer.nl
Accept: application/json
Content-Type: application/x-www-form-urlencoded

name=Nieuwe%20Kaartnaam&default_show_print=true&default_show_reset=true&default_show_measure=true

Example response:

{
    "error": false
}

Remove a map

POST /maps_api/v1/server/map/(string: identifier)/delete

Remove an existing map.

Parameters:
  • identifier (string) – The identifier as returned by the create call of the server API.
Response JSON Object:
 
  • error (boolean) – False if no error occured.

Example request:

POST /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/delete
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false
}

Retrieve the user layers

GET /maps_api/v1/server/map/(string: identifier)/layers

Get a list of user layers for the map. Note that these layers may change at any time and should not be cached.

Parameters:
  • identifier (string) – The identifier as returned by the create call of the server API.

Example request:

POST /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/layers
Host: planviewer.nl
Accept: application/json

Example response:

{
    "error": false,
    "layers": [
        {
            "name": "FVFunctiekaart",
            "id": 20,
            "type": "polygon"
        }
    ]
}

Retrieve the dossier outline

GET /maps_api/v1/server/map/(string: identifier)/outline

Retrieve the dossier outline polygon for a map.

Request Headers:
 
  • Accept

    (optional) Expected response formats. Supported formats are:

    • text/plain: A text-based EWKT (WKT with a prefixed SRID) response.
    • application/gml+xml;version=3.1 (application/gml+xml or text/xml are also allowed): A GML geometry XML response.
    • application/json (text/json or text/javascript are also allowed): A GeoJSON encoded JSON response.

    If no formats are provided then GeoJSON is assumed to be the requested format.

Parameters:
  • identifier (string) – The identifier as returned by the create call of the server API.
  • format (string) –

    (optional) A format may be appended instead of sending the Accept header. To do this append one of the following strings to the request URL:

    • .geojson (or .json): A GeoJSON encoded JSON response.
    • .gml (or .xml): A GML geometry XML response.
    • .ewkt (or .txt): A text-based EWKT (WKT with a prefixed SRID) response.

Example request:

GET /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/outline
Host: planviewer.nl
Accept: application/json

Example response:

{
    "type": "Polygon",
    "coordinates": [
        [[187621.749,426900.805],[187620.542,426892.892],[187620.442,426892.378],[187620.271,426891.883]]
    ]
}

Generate a snapshot image

GET /maps_api/v1/server/map/(string: identifier)/snapshot

Retrieve a snapshot image for a map.

Request Headers:
 
  • Accept

    (optional) Expected response formats. Supported formats are:

    • image/png: A png image (generally the best quality).
    • image/jpeg: A jpeg image (may give smaller file sizes in combination with aerial or satellite photo’s).

    If no formats are provided then PNG is assumed to be the requested format.

Parameters:
  • identifier (string) – The identifier as returned by the create call of the server API.
  • format (string) –

    (optional) A format may be appended instead of sending the Accept header. To do this append one of the following strings to the request URL:

    • .png: A png image (generally the best quality).
    • .jpg: A jpeg image (may give smaller file sizes in combination with aerial or satellite photo’s).
Query Parameters:
 
  • base_layer (boolean) – id property of the layer which should function as the base layer for the snapshot. You may use GET /maps_api/v1/server/background_layers to retrieve a list of base layers.
  • width (boolean) – (optional) Width of the generated image (default 250).
  • height (boolean) – (optional) Height of the generated image (default 250).
  • extent (boolean) – (optional) Bounding box of the generated snapshot (by default uses a bounding box of the dossier outline). Must be given in EPSG:28992 and must be specified by using the format: xmin,ymin,xmax,ymax (e.g.: 10,10,100,100).

Example request:

GET /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/snapshot.png
Host: planviewer.nl
Accept: image/png

Retrieve the user features

GET /maps_api/v1/server/map/(string: identifier)/features

Retrieve the user features from a map.

Request Headers:
 
  • Accept

    (optional) Expected response formats. Supported formats are:

    • text/csv: A CSV (comma separated values) response.
    • application/gml+xml;version=3.1 (application/gml+xml or text/xml are also allowed): A GML FeatureCollection XML response.
    • application/json (text/json or text/javascript are also allowed): A GeoJSON encoded JSON response.

    If no formats are provided then GeoJSON is assumed to be the requested format.

Parameters:
  • identifier (string) – The identifer as returned by the create call of the server API.
  • format (string) –

    (optional) A format may be appended instead of sending the Accept header. To do this append one of the following strings to the request URL:

    • geojson (or json): A GeoJSON encoded JSON response.
    • gml (or xml): A GML FeatureCollection XML response.
    • csv: A CSV (comma separated values) response.
Query Parameters:
 
  • include_geometry (boolean) – (optional) Whether or not to include the geometry field into the export (default false).

Example request:

GET /maps_api/v1/server/map/785e1c56c4c39b679ceba25d6b35008facf96c081afec413e953fd7b71941168/features.json
Host: planviewer.nl
Accept: application/json