Viewers

List viewers

GET /maps_api/v2/server/viewers

Returns the viewers currently created.

Query Parameters:
 
  • limit (integer) – A number between 1 and 100, indicating the maximum number of viewers returned per page.
  • offset (integer) – Start showing viewers at this offset.

Example request:

GET /maps_api/v2/server/viewers?limit=1 HTTP/1.1
Host: planviewer.nl
Accept: application/json

Example response:

{
    "viewers": [
        {
            "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "name": "Voorbeeld",
            "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
            "created_at": "2018-04-03T11:30:44+02:00",
            "updated_at": "2018-04-03T11:36:03+02:00"
        }
    ],
    "total_count": 2,
    "current_count": 1,
    "limit": 1,
    "offset": 0,
    "error": false,
    "next": {
        "url": "https://www.planviewer.test/maps_api/v2/server/viewers?limit=1&offset=1",
        "offset": 1,
        "limit": 1
    }
}

Create a new viewer

POST /maps_api/v2/server/viewers

Create a new 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.

Request JSON Object:
 
  • name (string) – A string specifying the name for the viewer (can be used to distinguish viewers for users).
  • default_show_print (boolean) – A boolean (true or false) to indicate whether printing is possible in this viewer.
  • default_show_reset (boolean) – A boolean (true or false) to indicate whether the view of the viewer can be reset by the user.
  • default_show_measure (boolean) – A boolean (true or false) to indicate whether a measuring tool is available to the user.

Example JSON request:

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

{
    "name": "example",
    "default_show_print": true,
    "default_show_reset": false,
    "default_show_measure": true
}

Example form request:

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

name=example&default_show_print=true&default_show_reset=false&default_show_measure=true

Example response:

{
    "error": false,
    "viewer": {
        "has_dossier_outline": false,
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "snapshot_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot",
        "outline_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/outline",
        "clone_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/clone",
        "sort_layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers",
        "create_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "upload_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/upload",
        "viewer_embed_url": "https://www.planviewer.test/maps_api/v2/embed/viewer/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "outline_embed_url": "https://www.planviewer.test/maps_api/v2/embed/dossier/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "name": "example",
        "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "default_show_print": true,
        "default_show_reset": false,
        "default_show_measure": true,
        "created_at": "2018-04-03T11:30:44+02:00",
        "updated_at": "2018-04-03T11:36:03+02:00"
    }
}

Get a viewer’s details

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

Get the specifics and details of a viewer given an identifier for some viewer.

Parameters:
  • identifier (string) – Identifier of the viewer for which to retrieve details.

Example request:

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

Example response:

{
    "error": false,
    "viewer": {
        "has_dossier_outline": true,
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "snapshot_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot",
        "outline_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/outline",
        "clone_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/clone",
        "sort_layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers",
        "create_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "upload_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/upload",
        "viewer_embed_url": "https://www.planviewer.test/maps_api/v2/embed/viewer/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "outline_embed_url": "https://www.planviewer.test/maps_api/v2/embed/dossier/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "name": "example",
        "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "default_show_print": true,
        "default_show_reset": false,
        "default_show_measure": true,
        "created_at": "2018-04-03T11:30:44+02:00",
        "updated_at": "2018-04-03T11:36:03+02:00"
    }
}

Update the viewer details

PATCH /maps_api/v2/server/viewers/(string: identifier)

Update the details of an existing viewer. Alternatively you can use the POST or PUT http methods, but you will need to specify all form fields 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 for which to update details.
Request JSON Object:
 
  • name (string) – Optional: A string specifying the name for the viewer (can be used to distinguish viewers for users).
  • default_show_print (boolean) – Optional: A boolean (true or false) to indicate whether printing is possible in this viewer.
  • default_show_reset (boolean) – Optional: A boolean (true or false) to indicate whether the view of the viewer can be reset by the user.
  • default_show_measure (boolean) – Optional: A boolean (true or false) to indicate whether a measuring tool is available to the user.

Example JSON request:

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

{
    "default_show_print": false
}

Example form request:

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

default_show_print=false

Example response:

{
    "error": false,
    "viewer": {
        "has_dossier_outline": true,
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "snapshot_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot",
        "outline_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/outline",
        "clone_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/clone",
        "sort_layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/sort_layers",
        "create_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers",
        "upload_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/upload",
        "viewer_embed_url": "https://www.planviewer.test/maps_api/v2/embed/viewer/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "outline_embed_url": "https://www.planviewer.test/maps_api/v2/embed/dossier/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "name": "example",
        "identifier": "138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae",
        "default_show_print": false,
        "default_show_reset": false,
        "default_show_measure": true,
        "created_at": "2018-04-03T11:30:44+02:00",
        "updated_at": "2018-04-03T11:36:03+02:00"
    }
}

Clone the viewer details

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

Clone a viewer. The details of the new viewer will be returned, it will be a copy of the original.

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

Example request:

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

Example response:

{
    "error": false,
    "viewer": {
        "has_dossier_outline": true,
        "self_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e",
        "layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/layers",
        "delete_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/delete",
        "update_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e",
        "snapshot_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/snapshot",
        "outline_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/outline",
        "clone_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/clone",
        "sort_layers_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/sort_layers",
        "create_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/layers",
        "upload_layer_url": "https://www.planviewer.test/maps_api/v2/server/viewers/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e/upload",
        "viewer_embed_url": "https://www.planviewer.test/maps_api/v2/embed/viewer/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e",
        "outline_embed_url": "https://www.planviewer.test/maps_api/v2/embed/dossier/210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e",
        "name": "example (kopie)",
        "identifier": "210c96664f73e8c5c2eb485568083083f9d7d7f125b0258360cd0c5bb2a9445e",
        "default_show_print": false,
        "default_show_reset": false,
        "default_show_measure": true,
        "created_at": "2018-04-03T11:30:44+02:00",
        "updated_at": "2018-04-03T11:36:03+02:00"
    }
}

Delete the viewer

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

Delete the viewer specified.

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

Example request:

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

Example response:

{
    "error": false
}

Create a viewer snapshot

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

Get a snapshot image of the current state of the viewer. Optionally, the format may be specified using a .(png|jpg) 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 png image will be returned.

Parameters:
  • identifier (string) – 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: png and jpg.
  • base_layer (int) – Optional. By default the first base layer available is used, if another layer is specified that layer will be used for the snapshot instead. This query parameter should contain the id of the base layer to be used.
  • width (int) – Optional. The width of the image, between 10 and 3000 pixels.
  • height (int) – Optional. The height of the image, between 10 and 3000 pixels.
Request Headers:
 
  • Accept – The returned image will have the format specified by this header, unless a format was specified using the format query parameter. Accepted values are: image/png and image/jpeg.

Example requests:

Using the Accept header:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot HTTP/1.1
Host: planviewer.nl
Accept: image/png

Using the format query parameter:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot?format=png HTTP/1.1
Host: planviewer.nl

Specify other parameters:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/snapshot?width=2000&height=2000&base_layer=1 HTTP/1.1
Host: planviewer.nl
Accept: image/png

Get the outline for the viewer

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

Get the outline geometry of the viewer. By default the format returned will be GeoJSON. Optionally, the format may be specified using a .(json|gml|txt) extension at the end of the url.

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

Example requests:

Using the Accept header to get the EWKT:

GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/outline HTTP/1.1
Host: planviewer.nl
Accept: text/plain

Using the format at the end of the url to get GeoJSON:

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