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.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

pydeck_carto-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pydeck-carto-0.2.0.tar.gz.

File metadata

  • Download URL: pydeck-carto-0.2.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.13

File hashes

Hashes for pydeck-carto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 98100ea7d4cef34f14947295ed5c59fda923c8453b60380824502d242ff01601
MD5 ad45b58cd7cd52a1f39770ac2bb9c679
BLAKE2b-256 3a891267c049b93af092dfd4227e43b485e880cc2f60659a027c3ca37d8abc38

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydeck_carto-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.13

File hashes

Hashes for pydeck_carto-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2282a4fec6ff255c1b56f5bcb2d15f42c635d75f1f5dd5b0e01c4eb32b9fd548
MD5 e0280e6e7eb733d13e2f0773d26daaad
BLAKE2b-256 9e2ded73eef520fab12657a9f5df030e7650d2722664687a23844c627fe00c78

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