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

Notebooks

See the notebooks directory for Juypter notebooks with complete examples of using the API.

Basic 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"

Create 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"]

Upload anything

from felt_python import upload_file

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, update_layer_style

current_style = get_layer(
    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.1.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

felt_python-0.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for felt_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58fb50c8671d49c94d19fd15b8104e569c59878445de395b5d21a2f6220e2daf
MD5 c0226de6dd44ba15f12e25979777b61e
BLAKE2b-256 4c56e61fc1938e8df75988684f7b6f6bd0acf95a13b463cc0e44ed64c7f928c0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for felt_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f17f5717e57866eb956d070af9525359c1022763d932b5d7006afc43cf80fd4d
MD5 502ddb33e0022b221a82cf27dde2a02c
BLAKE2b-256 6607665e62b1eb4658c0df03d732584fc4b5aed031e1e4bed71f79b0d7d8d886

See more details on using hashes here.

Supported by

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