This example illustrate how to publish a visualization using a GeoDataFrame.
Read more about Maps API Keys: https://carto.com/developers/auth-api/guides/types-of-API-Keys/
Note: CARTO Account credentials are needed to reproduce this example. https://carto.com/signup
In [1]:
from cartoframes.auth import set_default_credentials
set_default_credentials('creds.json')
In [2]:
from geopandas import read_file
gdf = read_file('http://libs.cartocdn.com/cartoframes/files/sustainable_palm_oil_production_mills.geojson')
In [3]:
from cartoframes.viz import Map, Layer
map_viz = Map(Layer(gdf))
In [4]:
map_viz.publish(
name='map_gdf',
password='1234',
if_exists='replace')
Out[4]:
In [5]:
from cartoframes import to_carto
to_carto(gdf, 'table_name', if_exists='replace')
Out[5]:
In [6]:
map_viz = Map(Layer('table_name'))
In [7]:
map_viz.publish(
name='map_table',
password='1234',
if_exists='replace')
Out[7]: