GeoPandas Support (GeoPandas and Shapely)

GeoPandas GeoDataFrame is a tabular data structure that contains a set of shapes (geometry) per each observation.

GeoDataFrame extends pandas DataFrame and as such, aside from the geometry, can contain other data.

GeoPandas supports the following three basic classes of geometric objects (shapes):

  • Points / Multi-Points

  • Lines / Multi-Lines

  • Polygons / Multi-Polygons

All GeoPandas shapes are “understood” by Lets-Plot and can be plotted using various geometry layers, depending on the type of the shape.

Use:

Plot Preliminaries

import pandas as pd

from lets_plot.geo_data import *
from lets_plot import *
LetsPlot.setup_html()

df = pd.DataFrame({
    'state': ['IL', 'IN', 'MI', 'OH', 'WI'],
    'pop_2021': [12_569_321, 6_805_663, 9_992_427, 11_714_618, 5_852_490],
})
gdf = geocode_states(names=df.state).scope('US').get_boundaries()[['state', 'geometry']]
The geodata is provided by © OpenStreetMap contributors and is made available here under the Open Database License (ODbL).