Field mappings¶
List the field mappings for a vector layer¶
-
GET/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/mappings¶ Get a list of field mappings for a vector layer.
Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
Example request:
GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings HTTP/1.1 Host: planviewer.nl Accept: application/json
Example response:
{ "error": false, "mappings": [ { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "id": 15, "title": "Gebied", "name": "GEBIED", "type": "loose_enum", "type_options": { "values": [ "alpha", "beta" ] }, "sort_order": 0, "created_at": "2018-08-14T12:08:09+02:00", "updated_at": "2018-08-14T12:08:09+02:00" }, { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/16", "id": 16, "title": "Commentaar", "name": "COMMENT", "type": "string", "type_options": [], "sort_order": 1, "created_at": "2018-08-15T12:20:03+02:00", "updated_at": "2018-08-15T12:20:03+02:00" } ] }
Sort the field mappings for a vector layer¶
-
POST/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/sort_mappings¶ Sort one or more field mappings of a vector layer. You may either position a single field to a new position, or send multiple locations in one go. When sorting field mappings, it is not required to sort all at once, fields not sent with the request will be re-ordered according to the fields that have been sent. This call will return a list of all field mappings to indicate the new state of all field mappings.
Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
Request JSON Object: - id (int) – The id of the field mapping for which to change the sorting if only a single field mapping is being sorted. See the examples below.
- sort_order (int) – The new position of the field mapping if only a single field mapping is being sorted. See the examples below.
- mappings (object[]) – If multiple field mappings are being sorted, they need to be sent using the mappings key. See the examples below.
Example JSON requests:
When sorting a single field mapping:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/sort_mappings HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "id": 15, "sort_order": 1 }
When sorting multiple field mappings at once:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/sort_mappings HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "mappings": [ {"id": 15, "sort_order": 1}, {"id": 16, "sort_order": 0} ] }
Example form requests:
When sorting a single field mapping:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/sort_mappings HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/x-www-form-urlencoded id=15&sort_order=1
When sorting multiple field mappings at once:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/sort_mappings HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/x-www-form-urlencoded mappings%5B0%5D%5Bid%5D=15&mappings%5B0%5D%5Bsort_order%5D=1&mappings%5B1%5D%5Bid%5D=16&mappings%5B1%5D%5Bsort_order%5D=0
Example response:
{ "error": false, "mappings": [ { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/16", "id": 16, "title": "Commentaar", "name": "COMMENT", "type": "string", "type_options": [], "sort_order": 0, "created_at": "2018-08-15T12:20:03+02:00", "updated_at": "2018-08-15T12:20:03+02:00" }, { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "id": 15, "title": "Gebied", "name": "GEBIED", "type": "loose_enum", "type_options": { "values": [ "alpha", "beta" ] }, "sort_order": 1, "created_at": "2018-08-14T12:08:09+02:00", "updated_at": "2018-08-15T12:21:37+02:00" } ] }
Create a new field mapping¶
-
POST/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/mappings¶ Create a new field mapping. This request may either be sent with a JSON body or a form url-encoded body. You must specify the
Content-Typeheader. See the examples for some usage.Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
Request JSON Object: - title (string) – The title of the field mapping (i.e. what the users sees)
- name (string) – The name of the field for this mapping (i.e. what feature field is used)
- type (string) – The type of field mapping. Currently only
loose_enumandstringare available. Also see theGET /maps_api/v2/server/mapping_typescall to get a list of available types with suggested translations for your end-users to consume. - type_options_values (string[]) – For a field mapping of type
loose_enumthis is required. It is a list of possible string values this field can have.
Example JSON request:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings HTTP/1.1 Host: planviewer.nl Content-Type: application/json Accept: application/json { "title": "Gebied", "name": "GEBIED", "type": "loose_enum", "type_options_values": [ "alpha", "beta" ] }
Example form request:
POST /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings HTTP/1.1 Host: planviewer.nl Content-Type: application/x-www-form-urlencoded Accept: application/json title=Gebied&name=GEBIED&type=loose_enum&type_options_values%5B0%5D=alpha&type_options_values%5B1%5D=beta
Example response:
{ "mapping": { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "delete_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15/delete", "update_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "id": 15, "title": "Gebied", "name": "GEBIED", "type": "loose_enum", "type_options": { "values": [ "alpha", "beta" ] }, "sort_order": 0, "created_at": "2018-08-14T12:08:09+02:00", "updated_at": "2018-08-14T12:08:09+02:00" }, "error": false }
Get a field mapping’s details¶
-
GET/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/mappings/(int: mapping)¶ Get the details of a field mapping for a vector layer in some viewer.
Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
- mapping (int) – Id of the field mapping.
Example request:
GET /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15 HTTP/1.1 Host: planviewer.nl Accept: application/json
Example response:
{ "mapping": { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "delete_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15/delete", "update_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "id": 15, "title": "Gebied", "name": "GEBIED", "type": "loose_enum", "type_options": { "values": [ "alpha", "beta" ] }, "sort_order": 0, "created_at": "2018-08-14T12:08:09+02:00", "updated_at": "2018-08-14T12:08:09+02:00" }, "error": false }
Update a field mapping¶
-
PATCH/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/mappings/(int: mapping)¶ Update an existing field mapping. This request may either be sent with a JSON body or a form url-encoded body. You must specify the
Content-Typeheader. See the examples for some usage. You may optionally also send this request as aPOSTorPUTrequest, this makes all fields required.Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
- mapping (int) – Id of the field mapping.
Request JSON Object: - title (string) – Optional: The title of the field mapping (i.e. what the users sees)
- name (string) – Optional: The name of the field for this mapping (i.e. what feature field is used)
- type (string) – Optional: The type of field mapping. Currently only
loose_enumandstringare available. Also see theGET /maps_api/v2/server/mapping_typescall to get a list of available types with suggested translations for your end-users to consume. - type_options_values (string[]) – Optional: For a field mapping of type
loose_enumthis is required. It is a list of possible string values this field can have.
Example JSON request:
PATCH /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15 HTTP/1.1 Host: planviewer.nl Content-Type: application/json Accept: application/json { "title": "Gebieden" }
Example form request:
PATCH /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15 HTTP/1.1 Host: planviewer.nl Content-Type: application/x-www-form-urlencoded Accept: application/json title=Gebieden
Example response:
{ "mapping": { "self_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "delete_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15/delete", "update_url": "https://www.planviewer.nl/maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15", "id": 15, "title": "Gebieden", "name": "GEBIED", "type": "loose_enum", "type_options": { "values": [ "alpha", "beta" ] }, "sort_order": 0, "created_at": "2018-08-14T12:08:09+02:00", "updated_at": "2018-08-14T12:08:09+02:00" }, "error": false }
Delete a field mapping¶
-
DELETE/maps_api/v2/server/viewers/(string: identifier)/layers/(int: layer)/mappings/(int: mapping)/delete¶ Delete an existing field mapping.
Parameters: - identifier (string) – Identifier of the viewer.
- layer (int) – Id of the layer.
- mapping (int) – Id of the field mapping.
Example request:
DELETE /maps_api/v2/server/viewers/138230fef76a818207720794e9a5c7db1ac243e9f42471737ccae5becfd7a2ae/layers/198/mappings/15/delete HTTP/1.1 Host: planviewer.nl Accept: application/json
Example response:
{ "error": false }