felt-python is a Python client for the Felt API. It provides convenient wrappers for common operations like creating, deleting and updating maps and data layers.
This client is especially useful at simplifying certain operations like uploading and refreshing files and (Geo)DataFrames or updating layer styles and element properties.
pip install felt-pythonTo authenticate with the Felt API, you need to provide your API token. You can either
pass it explicitly to function calls or set it in the FELT_API_TOKEN environment variable.
Use the Felt dashboard to create a new token.
importosos.environ["FELT_API_TOKEN"] ="YOUR_API_TOKEN"fromfelt_pythonimportcreate_mapresponse=create_map(
title="My new map",
lat=40,
lon=-3,
public_access="private",
)
map_id=response["id"]fromfelt_pythonimportupload_fileupload=upload_file(
map_id=map_id,
file_name="path/to/file.csv",
layer_name="My new layer",
)
layer_id=upload["layer_id"]importpandasaspdfromfelt_pythonimportupload_dataframedf=pd.read_csv("path/to/file.csv")
upload_dataframe(
map_id=map_id,
dataframe=df,
layer_name="Felt <3 Pandas",
)importgeopandasasgpdfromfelt_pythonimportupload_geodataframegdf=gpd.read_file("path/to/file.shp")
upload_geodataframe(
map_id=map_id,
geodataframe=gdf,
layer_name="Felt <3 GeoPandas",
)fromfelt_pythonimportrefresh_file_layerrefresh_file_layer(
map_id=map_id,
layer_id=layer_id,
file_name="path/to/new_file.csv",
)fromfelt_pythonimportget_layer, update_layer_stylecurrent_style=get_layer(
map_id=map_id,
layer_id=layer_id,
)["style"]
new_style=current_style.copy()
new_style["color"] ="#FF0000"new_style["size"] =20update_layer_style(
map_id=map_id,
layer_id=layer_id,
style=new_style,
)Check out our Juypter notebooks for a complete set of examples.
Visit the API Reference section of our Developer docs for complete documentation of all endpoints in the REST API.
We are always eager to hear from you. Reach out to support@felt.com for all your Felt support needs.