Skip to main content

Pydeck wrapper for use with CARTO

Project description

pydeck-carto

PyPI version Documentation Status

Pydeck wrapper for use with CARTO.

Install

pip install pydeck-carto

This also ensures pydeck is installed. If you haven't previously enabled pydeck to be used with Jupyter, follow its instructions to install.

Installing from source

git clone https://github.com/visgl/deck.gl
cd deck.gl/bindings/pydeck-carto
pip install .

Usage

import pydeck as pdk
import pydeck_carto as pdkc
from carto_auth import CartoAuth

# Authentication with CARTO
carto_auth = CartoAuth.from_oauth()

# Register new layer types in pydeck
pdkc.register_layers()

# Create CARTO data source
data = pdkc.sources.vector_query_source(
    access_token=carto_auth.get_access_token(),
    api_base_url=carto_auth.get_api_base_url(),
    connection_name="carto_dw",
    sql_query="SELECT geom, name FROM carto-demo-data.demo_tables.world_airports",
)

# Render CARTO layer in pydeck
layer = pdk.Layer(
    "VectorTileLayer",
    data=data,
    get_fill_color=[238, 77, 90],
    point_radius_min_pixels=2.5,
    pickable=True,
)
view_state = pdk.ViewState(latitude=0, longitude=0, zoom=1)
pdk.Deck(layer, map_style=pdk.map_styles.ROAD, initial_view_state=view_state)

For more information, check the examples section and the documentation.

Development

Make commands:

  • init: create the environment and install dependencies
  • lint: run linter (black + flake8)
  • test: run tests (pytest)
  • publish-pypi: publish package in pypi.org
  • publish-test-pypi: publish package in test.pypi.org
  • clean: remove the environment

Contributors

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

pydeck_carto-0.2.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

pydeck_carto-0.2.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file pydeck_carto-0.2.1.tar.gz.

File metadata

  • Download URL: pydeck_carto-0.2.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pydeck_carto-0.2.1.tar.gz
Algorithm Hash digest
SHA256 20156159f5a797db525836812d4108e237cb38985eaf43bba7d19344fa920fce
MD5 e1b420b08c9578923cf2a3d9a454d245
BLAKE2b-256 68db6b758d043bcaa0f1b97b89287d9fee93dc204c44e5def60b793fddd0a9d6

See more details on using hashes here.

File details

Details for the file pydeck_carto-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pydeck_carto-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pydeck_carto-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 115f5dab6bc73d651bd8a318b1dd0c39d4cefc23f28bcccebda79e191d559ce1
MD5 5b7f13a264d6b8d4b099eb981055a0e1
BLAKE2b-256 3b17a8cc244be5927d22cbbdc2e6309987d9fe79801b55ef41554e72f873f2b7

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