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.
post
/api/v2/maps/{map_id}/upload
Authorizations
Path parameters
map_idstringrequired
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.
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},
)
from felt_python import upload_file
map_id = "<YOUR_MAP_ID>"
path_to_file = "<YOUR_FILE_WITH_EXTENSION>" # Example: features.geojson
upload_file(
map_id=map_id,
file_name=path_to_file,
layer_name="My new layer",
)
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.
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.
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.
post
/api/v2/maps/{map_id}/layer_groups
Path parameters
map_idstringrequired
Body
idstring felt_id
Example: OI22G7wJRzOo2p1RQeHIPB
namestringrequired
Example: My Layer Group
ordering_keyinteger
subtitlestring
Example: A very interesting group
Responses
application/json
application/json
application/json
application/json
application/json
application/json
application/json
cURL
JavaScript
Python
HTTP
curl -L \
--request POST \
--url 'https://felt.com/api/v2/maps/{map_id}/layer_groups' \
--header 'Content-Type: application/json' \
--data '[{"id":"OI22G7wJRzOo2p1RQeHIPB","name":"My Layer Group","subtitle":"A very interesting group"}]'
Defaults to listing library layers for your "workspace". Use "felt" to list layers from the Felt data library. Use "all" to list layers from both sources.
Create an export request of a layer as a GeoPackage, GeoJSON, or CSV. Optionally include filters with the layer. Export requests are asynchronous. A successful response will return a poll_endpoint to check the status of the export.