Cloud Geodatabase Analysis and Visualization

This chapter will cover CARTOframes, a Python package released by location intelligence software company CARTO in November 2017. It offers a Python interface for working with the CARTO stack, enabling integration of CARTO maps, analysis, and data services into data science workflows.

This chapter will cover the following topics:

  • The specifics of the CARTOframes Python library
  • Getting familiar with the CARTO stack and how CARTOframes interacts with different parts of it
  • How to install CARTOframes, its package requirements, and documentation
  • The different package dependencies of CARTOframes
  • How to get a CARTO API key
  • Setting up a CARTO Builder account
  • Virtual environments
  • Using Jupyter Notebook
  • Installing GeoPandas

A Python package created with data scientists in mind, CARTOframes is a data science tool that combines CARTO's SaaS offerings and web mapping tools with Python data science workflows. Released in late 2017 by CARTO (www.carto.com), it is available for download through GitHub and the Python Package Index (PyPI) repository.

The package can be seen as a way to integrate CARTO elements with data science workflows, using Jupyter Notebooks as a working environment. This not only makes it attractive to use for data scientists, but also allows you to save and distribute code and workflows through Jupyter Notebooks. These data science workflows can be extended by using CARTO's services, such as hosted, dynamic, or static maps and datasets from CARTO's Data Observatory—all available through CARTO's cloud platform. This platform is accessed through an API key, which needs to be used when using CARTOframes in a Jupyter Notebook. We'll describe how to get an API key and how to install the CARTOframes package shortly.

The package offers functionality to read and write different types of spatial data. For instance, you can write pandas dataframes to CARTO tables, as well as read CARTO tables and queries into pandas dataframes. The CARTOframes package brings external data location data services from CARTO into the Jupyter Notebook, such as location data services, cloud-based data storage, CARTOColors (a set of custom color palettes built on top of well-known standards for color use on maps), PostGIS, and animated maps.

One good reason for using CARTOframes is because of its plotting capabilities. It is a good alternative to other map-plotting packages such as GeoPandas, matplotlib, Folio, and GeoNotebook. All these packages have their advantages and disadvantages. For example, matplotlib is not an easy package to learn and requires a lot of code for basic maps. This is not the case with CARTOframes, and the results look impressive, especially because of the use of colors, combined with dynamic images (time-lapses) and easy commands to read, write, query, plot and delete data. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset