Pydeck wrapper for use with CARTO
Project description
pydeck-carto
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()
# Render CARTO layer in pydeck
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",
)
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
Release history Release notifications | RSS feed
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.0b0.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for pydeck_carto-0.2.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 371ac3fc2a25acd986af17cf9a54ce4fad28ff49b8c1d85d2825fa5ac4dd32fb |
|
MD5 | 792414aad3b95320eca5c4c9d380d2c2 |
|
BLAKE2b-256 | 08782001c17f185e455de14f46a4e12d6235ee6b13ea0e56ea5ed14a5d8b332e |