# pydeck-carto
[![PyPI version](https://badge.fury.io/py/pydeck-carto.svg)](https://badge.fury.io/py/pydeck-carto)
[![Documentation Status](https://readthedocs.org/projects/pydeck-carto/badge/?version=latest)](https://pydeck-carto.readthedocs.io)
[Pydeck](https://pydeck.gl/) wrapper for use with [CARTO](carto.com).
## Install
```bash
pip install pydeck-carto
```
This also ensures [pydeck](https://pydeck.gl/) is installed. If you haven't previously enabled pydeck to be used with Jupyter, follow [its instructions](https://pydeck.gl/installation.html) to install.
### Installing from source
```bash
git clone https://github.com/visgl/deck.gl
cd deck.gl/bindings/pydeck-carto
pip install .
```
## Usage
```py
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](./examples) section and the [documentation](https://pydeck-carto.readthedocs.io).
## 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
- [Jesús Arroyo](https://github.com/jesus89)
- [Óscar Ramírez](https://github.com/tuxskar)
Raw data
{
"_id": null,
"home_page": "https://github.com/visgl/deck.gl/tree/master/bindings/pydeck-carto",
"name": "pydeck-carto",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pydeck, carto, visualization, graphics, GIS, maps",
"author": "CARTO",
"author_email": "jarroyo@carto.com",
"download_url": "https://files.pythonhosted.org/packages/3a/89/1267c049b93af092dfd4227e43b485e880cc2f60659a027c3ca37d8abc38/pydeck-carto-0.2.0.tar.gz",
"platform": null,
"description": "# pydeck-carto\n\n[![PyPI version](https://badge.fury.io/py/pydeck-carto.svg)](https://badge.fury.io/py/pydeck-carto)\n[![Documentation Status](https://readthedocs.org/projects/pydeck-carto/badge/?version=latest)](https://pydeck-carto.readthedocs.io)\n\n[Pydeck](https://pydeck.gl/) wrapper for use with [CARTO](carto.com).\n\n## Install\n\n```bash\npip install pydeck-carto\n```\n\nThis also ensures [pydeck](https://pydeck.gl/) is installed. If you haven't previously enabled pydeck to be used with Jupyter, follow [its instructions](https://pydeck.gl/installation.html) to install.\n\n### Installing from source\n\n```bash\ngit clone https://github.com/visgl/deck.gl\ncd deck.gl/bindings/pydeck-carto\npip install .\n```\n\n## Usage\n\n```py\nimport pydeck as pdk\nimport pydeck_carto as pdkc\nfrom carto_auth import CartoAuth\n\n# Authentication with CARTO\ncarto_auth = CartoAuth.from_oauth()\n\n# Register new layer types in pydeck\npdkc.register_layers()\n\n# Create CARTO data source\ndata = pdkc.sources.vector_query_source(\n access_token=carto_auth.get_access_token(),\n api_base_url=carto_auth.get_api_base_url(),\n connection_name=\"carto_dw\",\n sql_query=\"SELECT geom, name FROM carto-demo-data.demo_tables.world_airports\",\n)\n\n# Render CARTO layer in pydeck\nlayer = pdk.Layer(\n \"VectorTileLayer\",\n data=data,\n get_fill_color=[238, 77, 90],\n point_radius_min_pixels=2.5,\n pickable=True,\n)\nview_state = pdk.ViewState(latitude=0, longitude=0, zoom=1)\npdk.Deck(layer, map_style=pdk.map_styles.ROAD, initial_view_state=view_state)\n```\n\nFor more information, check the [examples](./examples) section and the [documentation](https://pydeck-carto.readthedocs.io).\n\n## Development\n\nMake commands:\n\n- init: create the environment and install dependencies\n- lint: run linter (black + flake8)\n- test: run tests (pytest)\n- publish-pypi: publish package in pypi.org\n- publish-test-pypi: publish package in test.pypi.org\n- clean: remove the environment\n\n## Contributors\n\n- [Jes\u00fas Arroyo](https://github.com/jesus89)\n- [\u00d3scar Ram\u00edrez](https://github.com/tuxskar)\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "Pydeck wrapper for use with CARTO",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/visgl/deck.gl/tree/master/bindings/pydeck-carto"
},
"split_keywords": [
"pydeck",
" carto",
" visualization",
" graphics",
" gis",
" maps"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e2ded73eef520fab12657a9f5df030e7650d2722664687a23844c627fe00c78",
"md5": "e0280e6e7eb733d13e2f0773d26daaad",
"sha256": "2282a4fec6ff255c1b56f5bcb2d15f42c635d75f1f5dd5b0e01c4eb32b9fd548"
},
"downloads": -1,
"filename": "pydeck_carto-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e0280e6e7eb733d13e2f0773d26daaad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7612,
"upload_time": "2024-04-29T19:22:23",
"upload_time_iso_8601": "2024-04-29T19:22:23.194337Z",
"url": "https://files.pythonhosted.org/packages/9e/2d/ed73eef520fab12657a9f5df030e7650d2722664687a23844c627fe00c78/pydeck_carto-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a891267c049b93af092dfd4227e43b485e880cc2f60659a027c3ca37d8abc38",
"md5": "ad45b58cd7cd52a1f39770ac2bb9c679",
"sha256": "98100ea7d4cef34f14947295ed5c59fda923c8453b60380824502d242ff01601"
},
"downloads": -1,
"filename": "pydeck-carto-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "ad45b58cd7cd52a1f39770ac2bb9c679",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8100,
"upload_time": "2024-04-29T19:22:24",
"upload_time_iso_8601": "2024-04-29T19:22:24.954982Z",
"url": "https://files.pythonhosted.org/packages/3a/89/1267c049b93af092dfd4227e43b485e880cc2f60659a027c3ca37d8abc38/pydeck-carto-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-29 19:22:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "visgl",
"github_project": "deck.gl",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pydeck-carto"
}