Map layer
User-supplied KML overlays drawn on top of the Navixy platform's map.
A map layer is a KML file a user uploads to draw their own geometry over the platform's map.
A layer is created by uploading its file and is read back as that same file. The layer object itself is metadata only, an ID and a name, so map_layer/update renames a layer and does nothing else. To replace the geometry, upload a new layer and delete the old one.
Map layer object
API actions
API base path: /map_layer.
Operations that list no errors of their own return only the general error codes.
Return the body of a map layer.
The response is the KML file itself, served as application/vnd.google-earth.kml+xml; charset=utf-8, not a JSON envelope. Only a failure comes back as JSON.
Reachable from a geo-link session as well as an ordinary one.
Also accepts GET with the same parameters as query-string values.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the map layer.
The layer body as KML
The KML document.
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/map_layer/read HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 8
{
"id": 1
}textErrors
These errors come in addition to the general error codes:
201 - Not found in the database, when the current user has no map layer with the given ID.
Return the metadata of every map layer belonging to the account. Bodies are not included; read them one at a time with map_layer/read.
Callable with an empty body. Reachable from a geo-link session as well as an ordinary one. Also accepts GET.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
The map layers
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/map_layer/list HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 2
{}{
"success": true,
"list": [
{
"id": 1,
"label": "text"
}
]
}Create a map layer from a KML file.
This is a multipart request, not JSON: multipart/form-data with the KML in a part named file. The file is validated against the KML 2.0 and 2.2 schemas and rejected if it does not conform.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
The KML file to import.
Name for the new layer. Trimmed, and cannot be empty.
Optional. URL to redirect to after the upload. When given, the response is a redirect to <redirect_target>?response=<urlencoded_response_json> instead of a JSON body.
The created layer
true if request finished successfully.
trueID of the new map layer.
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 268: the account's quota for map layers is exhausted.
Error 233: the file part is missing. Error 234: the file has the wrong MIME type. Error 242: the file is not valid KML.
Error response object
POST /v2/map_layer/upload HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: multipart/form-data
Accept: */*
Content-Length: 57
{
"file": "binary",
"label": "text",
"redirect_target": "text"
}{
"success": true,
"id": 1
}Errors
These errors come in addition to the general error codes:
233 - No data file, when the
filepart is missing.234 - Invalid data format, when the file has the wrong MIME type.
242 - Validation error, when the uploaded file is not valid KML.
268 - Over quota, when the user's quota for map layers is exceeded.
Rename a map layer.
Only the metadata changes. To replace the KML body, upload a new layer and delete the old one.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
Layer updated
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/map_layer/update HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 33
{
"layer": {
"id": 1,
"label": "text"
}
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - Not found in the database, when the current user has no map layer with the given ID.
Delete a map layer and its body.
Also accepts GET with the same parameters as query-string values.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the map layer.
Layer deleted
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/map_layer/delete HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 8
{
"id": 1
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - Not found in the database, when the current user has no map layer with the given ID.
Last updated
Was this helpful?