Import Geometries in a WKT or Shape File
Import polygons, polylines or points in WKT (Wellknown Text) or Shapefile format geometries using an HTTP POST request, or import WKT geometries using HTTP GET. A layer can contain only one geometry type - polygons, polylines or points, but not a mix of different types. After the response there is a delay of several seconds to compile, store and make the geometries available in the service.
Resource methods and URI
GET/POST/2/layers/upload.json
Query Parameters
Parameters | Required? | Description |
---|---|---|
file | For GET request | For GET requests: URL-encoded WKT file content as parameter value. For POST requests: Instead of this parameter, a multipart/form-data body is sent. The filename of the multipart entity is arbitrary. The file can be a plain or zipped WKT text file ending with .wkt, or a zipped archive containing a .shp, .shx and .dbf file (optionally .prj or .cpg files). A WKT file consists of TAB separated elements. The first line contains the column names, the last column must be "wkt". The subsequent lines contain the content, the attributes and the geometry. Both Shapefiles and WKT files must use unprojected WGS84. To create an index on a set of columns for faster all.josn responses, append ;* to these column names. |
app_id | Yes | A URL-safe encoded string obtained during the application registration. See Acquiring Credentials for information on getting credentials. |
app_code | Yes | A URL-safe encoded string obtained during the application registration. See Acquiring Credentials for information on getting credentials. |
layer_id | Yes | Layer the geometries are imported to. |
level | No | Specify tile size for the database for performance optimization |
storage | No | Either updatable or readonly . Default = updatable . If entries within a layer shall be modified later on, 'updatable' must be chosen. If the layer will always get replaced by full layer uploads, then readonly can be chosen. For readonly , larger data sets can be uploaded and the performance can be superior. |
wkt_quote | No | Specify the quote character to use. Default = " (double quotes). Specifying NONE disables quotes. |
callback | No | Specifies the function used to wrap the JSON response. |
Example WKT file
ADMIN_PLACE_ID CARTO_ID WKT
20300625 751498000 POLYGON ((1.73514 42.5498, 1.73619 42.55064, 1.73663 42.55115, 1.73682 42.55179, 1.73514 42.5498))
20128886 751882887 MULTIPOLYGON (((4.23844 51.37467, 4.22362 51.37412, 4.21795 51.3739, 4.22218 51.3673, 4.88942 51.42354, 4.89138 51.42328)))
Example WKT file defining an Index
STORE_TYPE;* ADMIN_PLACE_ID CARTO_ID WKT
13 20300625 751498000 POLYGON ((1.73514 42.5498, 1.73619 42.55064, 1.73663 42.55115, 1.73682 42.55179, 1.73514 42.5498))
14 20128886 751882887 MULTIPOLYGON (((4.23844 51.37467, 4.22362 51.37412, 4.21795 51.3739, 4.22218 51.3673, 4.88942 51.42354, 4.89138 51.42328)))