Refreshing live data layers
Refreshing a layer with a file
1. Request a refresh via the Felt API
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>"
layer_id = "<YOUR_LAYER_ID>"
r = requests.post(
f"http://felt.com/api/v2/maps/{map_id}/layers/{layer_id}/refresh",
headers={"Authorization": f"Bearer {api_token}"}
)
assert r.ok
presigned_upload = r.json()import os
from felt_python import refresh_file_layer
# Setting your API token as an env variable can save
# you from repeating it in every function call
os.environ["FELT_API_TOKEN"] = "<YOUR_API_TOKEN>"
map_id = "<YOUR_MAP_ID>"
layer_id = "<YOUR_LAYER_ID>"
new_file_name = "<PATH_TO_NEW_FILE>"
refresh_file_layer(
map_id=map_id,
layer_id=layer_id,
file_name=new_file_name
)2. Upload your file(s) to Amazon s3
Refreshing a layer with a URL
Last updated
Was this helpful?