dapper.topounit.topoplot

Plotting utilities for topounits and domains.

Functions

plot_interactive(gdf[, tiles, tooltip_cols, ...])

Interactive Folium map.

plot_static(gdf[, basemap, figsize, alpha, ...])

Static plot with contextily basemap.

prepare_for_plot(gdf[, area_epsg, area_col, ...])

dapper.topounit.topoplot.plot_interactive(gdf, tiles='CartoDB positron', tooltip_cols=('legend_label', 'area_km2', 'band_name', 'analysis_scale_m'), style_kwds=None)[source]

Interactive Folium map. Returns a folium.Map.

Parameters:
  • gdf (geopandas.GeoDataFrame)

  • tiles (str)

dapper.topounit.topoplot.plot_static(gdf, basemap='positron', figsize=(10, 10), alpha=0.6, edgecolor='black', linewidth=0.7, legend=True, cmap=None, ax=None)[source]

Static plot with contextily basemap. basemap options: ‘positron’, ‘dark’, ‘osm’, ‘terrain’, ‘satellite’ If ax is provided, draw into that axes (and do not create a new figure).

Parameters:
  • gdf (geopandas.GeoDataFrame)

  • basemap (str)

  • alpha (float)

  • edgecolor (str)

  • linewidth (float)

  • legend (bool)

dapper.topounit.topoplot.prepare_for_plot(gdf, area_epsg=3857, area_col='area_km2', ndigits_numeric=0, order=None)[source]
Return type:

GeoDataFrame

Parameters:
  • gdf (geopandas.GeoDataFrame)

  • area_epsg (int)

  • area_col (str)

  • ndigits_numeric (int)

  • order (list[str] | None)

Returns a copy with:
  • legend_label: pretty combined label for legend/coloring

  • area_km2: polygon area (in km²) computed in a projected CRS (default EPSG:3857)