Geovisualization Developer's Guide

Upload Layer

The upload layer request to the Geovisualization REST API requires a request body containing the layer definition. The Content-Length header is required in the request. The request body must be of type multipart/form-data, containing a file in one of the following supported spatial formats:

  • MapInfo TAB files, packaged in a zip file
  • ESRI Shapefile, packaged in a zip file

Alternatively, a JSON object can be sent in the body containing a URL indicating the location of the layer definition. Only the SFTP protocol is supported, and the URL must point to a directory instead of a file. All csv, csv.gz or zip files in that directory are downloaded and added to the layer. There can only be one type of file in the directory (csv, csv.gz, or zip). The layer must have a predefined schema and all files in the directory must conform to it.

Zip files can be encrypted with AES, and the encryption key must be passed in the file_password element.

SFTP requires the username and password to be part of the JSON request body. They can either be given in separate attributes or as part of the URL. Optionally a private key can be passed if required by the SFTP server.

Note that the parameters description, to_srid and capabilities can be passed in the JSON object instead of as query parameters.

Table 1. Upload Layer Request Elements
Element Data Type Mandatory Description
url String Yes URL pointing to a directory on an SFTP server
username String No Username required to access the SFTP server
password String No Password required to access the SFTP server
private_key String No Private key optionally required by the SFTP server
file_password String No Password for files contained in AES-encrypted zip files

The code example below shows the data structure sent in a request to create a new layer by specifying an external source on an SFTP server.

      "source": {
        "url": "sftp://321.51.31.42/layers",
        "username": "bob",
        "password": "<redacted>",
        "to_srid": "4326"