Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change Layer API - Dataframe / Common Source

See original GitHub issue

Related with


This issue focuses on continuing the previous issue about the Layer API (

The first part of changing the Layer API was to use a single Layer class instead of having different Layer types, and create different sources that are equivalent to CARTO VL sources for consistency.

In this second step, we aim to use the Dataframe class to have the possibility of generating sources in the notebook and pass it to the Layer.

From this comment by @oleurud:

The user wants to make things over the data (using Pandas) and then render a map with the data. To do this, we have 2 options:

  • OPTION 1: the user makes things over the data (pandas or other ways), then upload the data to CARTO and finally use the VL way to render the map. To do this, if I am not wrong, we don’t have to integrate anything between backend and frontend.
  • OPTION 2: the user makes things over the data (pandas) and then the user has a way to send the pandas.DataFrame to VL. To do this, we have to integrate backend and frontend (find a way to send a pandas.DataFrames to VL). The yesterday proposal was talking about this case, because I think having a full local way to render a map is powerful. I want to talk about it with @javitonino & @alrocar. But of course, any feedback is welcome.

The first one is already implemented by frontend team. So the objective here is to find the best way to make possible the second one (if it makes sense)

Other questions / ToDo:

  • Use a Layer as a stand-alone map a la (from this comment)
  • Discuss: Should we sort the layers?


We have finally decided to simplify the API. New examples are contained in /examples/debug/API. This is an example of the usage:

from cartoframes import Context, set_default_context
from cartoframes.vis import Map, Layer

context = Context(

# Table name
Map(Layer('populated_places', 'color: blue'))

# SQL query
Map(Layer('SELECT * FROM populated_places LIMIT 10'))

# GeoJSON (object, features, feature, geometry, filename, GDF)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

Jesus89commented, May 13, 2019

I have implemented here the idea of the connection between Source and Dataset, and also added some examples with the approach for the API:

elenatorrocommented, Apr 30, 2019

I included a PoC encoding the GeoJSON in base64 in the current PR:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to the Spatially Enabled DataFrame
The Spatially Enabled DataFrame inserts a custom namespace called spatial into the popular Pandas DataFrame structure to give it spatial abilities. This allows ......
Read more >
Data Engineering with Spatially Enabled DataFrames and ...
Pandas is a data analysis and data engineering library that is very popular in the scientific Python ecosystem. The ArcGIS API for Python ......
Read more >
pandas.DataFrame.stack — pandas 1.5.2 documentation
Return a reshaped DataFrame or Series having a multi-level index with one or more new inner-most levels compared to the current DataFrame. The...
Read more >
Pandas API on Upcoming Apache Spark™ 3.2 - Databricks
A few years ago, we launched Koalas, an open source project that implements the pandas DataFrame API on top of Spark, which became...
Read more >
Load a pandas DataFrame | TensorFlow Core
Typically, Keras models and layers expect a single input tensor, but these classes can accept and return nested structures of dictionaries, tuples and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found