Skip to content

PhilaController/carto2gpd

Repository files navigation

carto2gpd

Coverage Status t PyPi version Anaconda-Server Badge

A Python utility to query a CARTO database and return a geopandas GeoDataFrame.

Installation

Via conda:

conda install -c controllerphl carto2gpd

Via PyPi:

pip install carto2gpd

Example

import carto2gpd

url = "https://phl.carto.com/api/v2/sql"
where = "date_ > current_date - 30"
gdf = carto2gpd.get(url, "shootings", fields=['age', 'fatal'], where=where, limit=5)

gdf.head()

There is also a utility function to get the size of a CARTO database:

url = "https://phl.carto.com/api/v2/sql"
size = carto2gpd.get_size(url, "shootings")
size

About

Query a CARTO database and return a geopandas GeoDataFrame.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published