Layers

Uploading a file or URL

Check our Upload Anything docs to see what URLs are supported.

The /upload endpoint can be used for both URL and file uploads:

  • For URL uploads, simply making a single POST request to the upload endpoint is enough

  • For file uploads, the response of the initial POST request will include a target URL and some pre-signed attributes, which will be used to upload the new file to Amazon S3.

POSThttps://felt.com/api/v2/maps/{map_id}/upload
Authorization
Path parameters
map_id*string

The ID of the map to upload the layer to.

Body
import_urlstring

A public URL containing geodata to import, in place of uploading a file.

latnumber

(Image uploads only) The latitude of the image center.

lngnumber

(Image uploads only) The longitude of the image center.

name*string

The display name for the new layer.

zoomnumber

(Image uploads only) The zoom level of the image.

Response

UploadResponse

Body
layer_group_idstring (felt_id)
Example: "RShuaEiiRTm19ALxAAf9Ar5B"
layer_idstring (felt_id)

The ID of the layer created by this upload. If multiple layers are included in the upload, this is the ID of the first layer in the layer group.

Example: "grxbBVKoRUWKYh77urpGWD"
presigned_attribuesnullable object

If provided, the presigned attributes to attach to the post request

typeenum
upload_response
urlnullable string

If provided, the URL to post the file to

Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/upload', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "text"
    }),
});
const data = await response.json();
Response
{
  "layer_group_id": "RShuaEiiRTm19ALxAAf9Ar5B",
  "layer_id": "grxbBVKoRUWKYh77urpGWD",
  "type": "upload_response",
  "url": "text"
}

This endpoint is used to create a layer, and obtain a pre-signed url to upload the layer files to S3.

Uploading the file to Amazon S3

Uploading a file is a single function call using the felt-python library.

Layer files aren’t uploaded directly to the Felt API. Instead, they are uploaded by your client directly to an S3 bucket.

You will receive a single set of URL and pre-signed params to upload the file. Only a single file may be uploaded — if you wish to upload several files at once, consider wrapping them in a zip file.

To upload the file using the pre-signed params, you must perform a multipart upload, and include the file contents in the file field:

# Requires requests library to be installed with: pip install requests
import requests

# Your API token should look like this:
# api_token = "felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
api_token = "<YOUR_API_TOKEN>"
map_id = "<YOUR_MAP_ID>"
path_to_file = "<YOUR_FILE_WITH_EXTENSION>" # Example: features.geojson

# Request  a pre-signed URL from Felt
layer_response = requests.post(
    f"https://felt.com/api/v2/maps/{map_id}/upload",
    headers={
        "authorization": f"Bearer {api_token}",
        "content-type": "application/json",
    },
    json={"name": "My new layer"},
)
presigned_upload = layer_response.json()
url = presigned_upload["data"]["attributes"]["url"]
presigned_attributes = presigned_upload["data"]["attributes"]["presigned_attributes"]
# A 204 response indicates that the upload was successful
with open(path_to_file, "rb") as file_obj:
    output = requests.post(
        url,
        # Order is important, file should come at the end
        files={**presigned_attributes, "file": file_obj},
    )

Refreshing a layer

Refreshing a file is a single function call using the felt-python library.

After uploading a file or URL, you may want to update the resulting layer with some new data. The process is quite similar to the above:

  • For URL uploads, simply making a single POST request to the refresh endpoint is enough

  • For file uploads, the response of the initial POST request will include a URL and some presigned attributes, which will be used to upload the new file to Amazon S3. See Uploading the file to Amazon S3 for more details.

POSThttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/refresh
Authorization
Path parameters
map_id*string

The ID of the map hosting the layer to refresh

layer_id*string

The ID of the layer to refresh

Response

UploadResponse

Body
layer_group_idstring (felt_id)
Example: "RShuaEiiRTm19ALxAAf9Ar5B"
layer_idstring (felt_id)

The ID of the layer created by this upload. If multiple layers are included in the upload, this is the ID of the first layer in the layer group.

Example: "grxbBVKoRUWKYh77urpGWD"
presigned_attribuesnullable object

If provided, the presigned attributes to attach to the post request

typeenum
upload_response
urlnullable string

If provided, the URL to post the file to

Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/refresh', {
    method: 'POST',
    headers: {},
});
const data = await response.json();
Response
{
  "layer_group_id": "RShuaEiiRTm19ALxAAf9Ar5B",
  "layer_id": "grxbBVKoRUWKYh77urpGWD",
  "type": "upload_response",
  "url": "text"
}

Deleting a layer

DELETEhttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}
Path parameters
map_id*string

The ID of the map to delete the layer from

layer_id*string

The ID of the layer to delete

Response

No Content

Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();
Response
{
  "errors": [
    {
      "detail": "text",
      "source": {
        "header": "authorization"
      },
      "title": "text"
    }
  ]
}

Styling layers

Update a layer's style

A layer's style may be updated by providing a new Felt Style Language object. Learn more in the guide:

Styling layers

POSThttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/update_style
Path parameters
map_id*string

The ID of the map where the layer is located

layer_id*string

The ID of the layer to update the style of

Body
style*object

The new layer style, specified in Felt Style Language format

Response

Dataset

Body
geometry_type*nullable enum
LinePointPolygonRaster
hide_from_legend*boolean
id*string (felt_id)
Example: "k441enUxQUOnZqc1ZvNsDA"
is_spreadsheetnullable boolean
linksobject
name*string
ordering_keynullable integer

A sort order key used for ordering layers and layer groups in the legend

progress*number (float)
status*enum
uploadingprocessingfailedcompleted
style*object

The Felt Style Language style for the layer

subtitle*nullable string
tile_urlnullable string

The tile URL for this layer

type*enum
layer
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/update_style', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "geometry_type": "Line",
  "hide_from_legend": false,
  "id": "k441enUxQUOnZqc1ZvNsDA",
  "is_spreadsheet": false,
  "links": {
    "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
  },
  "name": "text",
  "progress": 0,
  "status": "uploading",
  "subtitle": "text",
  "tile_url": "text",
  "type": "layer"
}

Managing layers

Get all the layers on a map

Get the details of all the layer on the map that are not within a layer group.

GEThttps://felt.com/api/v2/maps/{map_id}/layers
Path parameters
map_id*string
Response

Layers

Body
geometry_type*nullable enum
LinePointPolygonRaster
hide_from_legend*boolean
id*string (felt_id)
Example: "k441enUxQUOnZqc1ZvNsDA"
is_spreadsheetnullable boolean
linksobject
name*string
ordering_keynullable integer

A sort order key used for ordering layers and layer groups in the legend

progress*number (float)
status*enum
uploadingprocessingfailedcompleted
style*object

The Felt Style Language style for the layer

subtitle*nullable string
tile_urlnullable string

The tile URL for this layer

type*enum
layer
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  {
    "geometry_type": "Line",
    "hide_from_legend": false,
    "id": "k441enUxQUOnZqc1ZvNsDA",
    "is_spreadsheet": false,
    "links": {
      "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
    },
    "name": "text",
    "progress": 0,
    "status": "uploading",
    "subtitle": "text",
    "tile_url": "text",
    "type": "layer"
  }
]

Get a single layer

Get the details of a single layer on the map. These details include:

  • Name of the layer

  • Upload status and progress

  • Style, expressed in the Felt Style Language

  • Other metadata, such as the geometry type, visibility state in the legend, etc

GEThttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}
Path parameters
map_id*string
layer_id*string
Response

Layer

Body
geometry_type*nullable enum
LinePointPolygonRaster
hide_from_legend*boolean
id*string (felt_id)
Example: "k441enUxQUOnZqc1ZvNsDA"
is_spreadsheetnullable boolean
linksobject
name*string
ordering_keynullable integer

A sort order key used for ordering layers and layer groups in the legend

progress*number (float)
status*enum
uploadingprocessingfailedcompleted
style*object

The Felt Style Language style for the layer

subtitle*nullable string
tile_urlnullable string

The tile URL for this layer

type*enum
layer
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "geometry_type": "Line",
  "hide_from_legend": false,
  "id": "k441enUxQUOnZqc1ZvNsDA",
  "is_spreadsheet": false,
  "links": {
    "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
  },
  "name": "text",
  "progress": 0,
  "status": "uploading",
  "subtitle": "text",
  "tile_url": "text",
  "type": "layer"
}

Updating a layer's details

Update a layer's name or move it into or out of a layer group.

To move a layer into a group, set the layer_group_id to the id of the layer group you want to move the layer into. To move a layer out of a group, set the layer_group_id to null.

POSThttps://felt.com/api/v2/maps/{map_id}/layers
Path parameters
map_id*string
Body
id*string (felt_id)
Example: "nOFB8jOFSne1DuDr2uFn4A"
layer_group_idnullable string (felt_id)
Example: "KFFhKAbvS4anD3wxtwNEpD"
namestring
Example: "My Layer"
ordering_keyinteger
subtitlestring
Example: "A very interesting dataset"
Response

Layer

Body
geometry_type*nullable enum
LinePointPolygonRaster
hide_from_legend*boolean
id*string (felt_id)
Example: "k441enUxQUOnZqc1ZvNsDA"
is_spreadsheetnullable boolean
linksobject
name*string
ordering_keynullable integer

A sort order key used for ordering layers and layer groups in the legend

progress*number (float)
status*enum
uploadingprocessingfailedcompleted
style*object

The Felt Style Language style for the layer

subtitle*nullable string
tile_urlnullable string

The tile URL for this layer

type*enum
layer
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify([
      {
        "id": "nOFB8jOFSne1DuDr2uFn4A"
      }
    ]),
});
const data = await response.json();
Response
[
  {
    "geometry_type": "Line",
    "hide_from_legend": false,
    "id": "k441enUxQUOnZqc1ZvNsDA",
    "is_spreadsheet": false,
    "links": {
      "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
    },
    "name": "text",
    "progress": 0,
    "status": "uploading",
    "subtitle": "text",
    "tile_url": "text",
    "type": "layer"
  }
]

Layer groups

Get details of a layer group

GEThttps://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}
Path parameters
map_id*string
layer_group_id*string
Response

Layer Group

Body
id*string (felt_id)
Example: "v13k4Ae9BRjCHHdPP5Fcm6D"
layers*array of Layer
linksobject
name*string
ordering_keyinteger

A sort order key used for ordering layers and layer groups in the legend

subtitle*nullable string
type*enum
layer_group
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "id": "v13k4Ae9BRjCHHdPP5Fcm6D",
  "layers": [
    {
      "geometry_type": "Line",
      "hide_from_legend": false,
      "id": "k441enUxQUOnZqc1ZvNsDA",
      "is_spreadsheet": false,
      "links": {
        "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
      },
      "name": "text",
      "progress": 0,
      "status": "uploading",
      "subtitle": "text",
      "tile_url": "text",
      "type": "layer"
    }
  ],
  "links": {
    "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layer_groups/v13k4Ae9BRjCHHdPP5Fcm6D"
  },
  "name": "text",
  "subtitle": "text",
  "type": "layer_group"
}

Delete a layer group

DELETEhttps://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}
Path parameters
map_id*string

The ID of the map to delete the layer group from

layer_group_id*string

The ID of the layer group to delete

Response

No Content

Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();
Response
{
  "errors": [
    {
      "detail": "text",
      "source": {
        "header": "authorization"
      },
      "title": "text"
    }
  ]
}

Create or update layer groups

Provide an array of layer group objects to create new groups or update existing ones.

For each layer group object, including an existing ID will result in the group's details (name, subtitle and legend order) being updated. If no layer group ID is provided (or a non-existent one is provided), a new layer group will be created.

POSThttps://felt.com/api/v2/maps/{map_id}/layer_groups
Path parameters
map_id*string
Body
idstring (felt_id)
Example: "OI22G7wJRzOo2p1RQeHIPB"
name*string
Example: "My Layer Group"
ordering_keyinteger
subtitlestring
Example: "A very interesting group"
Response

LayerGroup

Body
id*string (felt_id)
Example: "v13k4Ae9BRjCHHdPP5Fcm6D"
layers*array of Layer
linksobject
name*string
ordering_keyinteger

A sort order key used for ordering layers and layer groups in the legend

subtitle*nullable string
type*enum
layer_group
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layer_groups', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify([
      {
        "name": "My Layer Group"
      }
    ]),
});
const data = await response.json();
Response
[
  {
    "id": "v13k4Ae9BRjCHHdPP5Fcm6D",
    "layers": [
      {
        "geometry_type": "Line",
        "hide_from_legend": false,
        "id": "k441enUxQUOnZqc1ZvNsDA",
        "is_spreadsheet": false,
        "links": {
          "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
        },
        "name": "text",
        "progress": 0,
        "status": "uploading",
        "subtitle": "text",
        "tile_url": "text",
        "type": "layer"
      }
    ],
    "links": {
      "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layer_groups/v13k4Ae9BRjCHHdPP5Fcm6D"
    },
    "name": "text",
    "subtitle": "text",
    "type": "layer_group"
  }
]

Layer library

Listing layers

List all layers in your workspace's Library

GEThttps://felt.com/api/v2/library
Authorization
Query parameters
Response

LayerLibrary

Body
layer_groups*array of LayerGroup
layers*array of Layer
type*enum
layer_library
Request
const response = await fetch('https://felt.com/api/v2/library', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "layer_groups": [
    {
      "id": "v13k4Ae9BRjCHHdPP5Fcm6D",
      "layers": [
        {
          "geometry_type": "Line",
          "hide_from_legend": false,
          "id": "k441enUxQUOnZqc1ZvNsDA",
          "is_spreadsheet": false,
          "links": {
            "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
          },
          "name": "text",
          "progress": 0,
          "status": "uploading",
          "subtitle": "text",
          "tile_url": "text",
          "type": "layer"
        }
      ],
      "links": {
        "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layer_groups/v13k4Ae9BRjCHHdPP5Fcm6D"
      },
      "name": "text",
      "subtitle": "text",
      "type": "layer_group"
    }
  ],
  "layers": [
    {
      "geometry_type": "Line",
      "hide_from_legend": false,
      "id": "k441enUxQUOnZqc1ZvNsDA",
      "is_spreadsheet": false,
      "links": {
        "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
      },
      "name": "text",
      "progress": 0,
      "status": "uploading",
      "subtitle": "text",
      "tile_url": "text",
      "type": "layer"
    }
  ],
  "type": "layer_library"
}

Publishing a layer

Publish a layer to your workspace's library

POSThttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/publish
Path parameters
map_id*string

The ID of the map where the layer is located

layer_id*string

The ID of the layer to publish

Body
namestring

The name to publish the layer under

Example: "My Layer"
Response

Publish layer response

Body
geometry_type*nullable enum
LinePointPolygonRaster
hide_from_legend*boolean
id*string (felt_id)
Example: "k441enUxQUOnZqc1ZvNsDA"
is_spreadsheetnullable boolean
linksobject
name*string
ordering_keynullable integer

A sort order key used for ordering layers and layer groups in the legend

progress*number (float)
status*enum
uploadingprocessingfailedcompleted
style*object

The Felt Style Language style for the layer

subtitle*nullable string
tile_urlnullable string

The tile URL for this layer

type*enum
layer
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/publish', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "geometry_type": "Line",
  "hide_from_legend": false,
  "id": "k441enUxQUOnZqc1ZvNsDA",
  "is_spreadsheet": false,
  "links": {
    "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
  },
  "name": "text",
  "progress": 0,
  "status": "uploading",
  "subtitle": "text",
  "tile_url": "text",
  "type": "layer"
}

Publishing a layer group

Publish a layer group to your workspace's library

POSThttps://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}/publish
Path parameters
map_id*string

The ID of the map where the layer group is located

layer_group_id*string

The ID of the layer group to publish

Body
namestring

The name to publish the layer group under

Example: "My Layer Group"
Response

Publish layer grup response

Body
id*string (felt_id)
Example: "v13k4Ae9BRjCHHdPP5Fcm6D"
layers*array of Layer
linksobject
name*string
ordering_keyinteger

A sort order key used for ordering layers and layer groups in the legend

subtitle*nullable string
type*enum
layer_group
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layer_groups/{layer_group_id}/publish', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "id": "v13k4Ae9BRjCHHdPP5Fcm6D",
  "layers": [
    {
      "geometry_type": "Line",
      "hide_from_legend": false,
      "id": "k441enUxQUOnZqc1ZvNsDA",
      "is_spreadsheet": false,
      "links": {
        "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layers/k441enUxQUOnZqc1ZvNsDA"
      },
      "name": "text",
      "progress": 0,
      "status": "uploading",
      "subtitle": "text",
      "tile_url": "text",
      "type": "layer"
    }
  ],
  "links": {
    "self": "/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layer_groups/v13k4Ae9BRjCHHdPP5Fcm6D"
  },
  "name": "text",
  "subtitle": "text",
  "type": "layer_group"
}

Downloading layers

Get a link to export a layer as a GeoPackage (vector layers) or GeoTIFF (raster layers).

GEThttps://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/get_export_link
Path parameters
map_id*string

The ID of the map where the layer is located

layer_id*string

The ID of the layer to export

Response

Export link

Body
export_link*string
Request
const response = await fetch('https://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/get_export_link', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "export_link": "text"
}

Last updated