Skip to main content

The official Felt API client library

Project description

The official Python client for the Felt API

PyPI Binder open_in_colab

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.

Installation

pip install felt-python

Usage

Authentication

To 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.

import os

os.environ["FELT_API_TOKEN"] = "YOUR_API_TOKEN"

Creating a map

from felt_python import create_map

response = create_map(
    title="My new map",
    lat=40,
    lon=-3,
    public_access="private",
)
map_id = response["id"]

Uploading a file

from felt_python import upload_file, list_layers

upload = upload_file(
    map_id=map_id,
    file_name="path/to/file.csv",
    layer_name="My new layer",
)
layer_id = upload["layer_id"]

Uploading a Pandas DataFrame

import pandas as pd
from felt_python import upload_dataframe

df = pd.read_csv("path/to/file.csv")
upload_dataframe(
    map_id=map_id,
    dataframe=df,
    layer_name="Felt <3 Pandas",
)

Uploading a GeoPandas GeoDataFrame

import geopandas as gpd
from felt_python import upload_geodataframe

gdf = gpd.read_file("path/to/file.shp")
upload_geodataframe(
    map_id=map_id,
    geodataframe=gdf,
    layer_name="Felt <3 GeoPandas",
)

Refreshing a layer

from felt_python import refresh_file_layer

refresh_file_layer(
    map_id=map_id,
    layer_id=layer_id,
    file_path="path/to/new_file.csv",
)

Styling a layer

from felt_python import get_layer_details, update_layer_style

current_style = get_layer_details(
    map_id=map_id,
    layer_id=layer_id,
)["style"]
new_style = current_style.copy()
new_style["color"] = "#FF0000"
new_style["size"] = 20
update_layer_style(
    map_id=map_id,
    layer_id=layer_id,
    style=new_style,
)

Support

We are always eager to hear from you. Reach out to support@felt.com for all your Felt support needs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

felt_python-0.0.5.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

felt_python-0.0.5-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file felt_python-0.0.5.tar.gz.

File metadata

  • Download URL: felt_python-0.0.5.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.10

File hashes

Hashes for felt_python-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c24621f7ea81b4ea02d9e584574508f8ae66cf53dc71a8ae0624985ff0f6cb88
MD5 7e151edc9035b5cc98765f2759d692aa
BLAKE2b-256 106ce7615809afd92f453c92fe736aceb22583285199a5d7c4d2162b86a7c539

See more details on using hashes here.

File details

Details for the file felt_python-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: felt_python-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.10

File hashes

Hashes for felt_python-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f4abf294000f5eacaff55b52fd92688802a33d3dac2a99b47af7ae01863bfdeb
MD5 3ee98dcea43171911c062db81b4a9879
BLAKE2b-256 304edd5cda2bd323bc4d6f20974df17df853058bc63002b228d302846f5df382

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page