holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.24k stars 363 forks source link

Add support for GeoPandas lines and points #1293

Closed ianthomas23 closed 8 months ago

ianthomas23 commented 8 months ago

This builds on PR #1285 to support rendering GeoPandas GeoSeries as lines and points as well as the existing polygons.

There is no support for LinearRing yet as that is not supported by shapely.to_ragged_array.

Example:

import colorcet as cc
import datashader as ds
import geodatasets
import geopandas

df = geopandas.read_file(geodatasets.get_path("nybb"))
df["area"] = df.area

canvas = ds.Canvas(plot_height=600, plot_width=600)
agg = canvas.line(source=df, geometry="geometry", agg=ds.max("area"))
ds.transfer_functions.shade(agg, cmap=cc.bgy, how="linear")

generates this image: temp

Lines support antialiasing as usual. All GeoPandas tests moved to their own file test_geopandas.py which also includes equivalent SpatialPandas tests that are pixel identical.

Example notebook to follow in separate PR.

Pinging @jorisvandenbossche and @martinfleis for visibility.

codecov[bot] commented 8 months ago

Codecov Report

Merging #1293 (637f1f8) into main (606f7bf) will decrease coverage by 0.09%. The diff coverage is 80.70%.

@@            Coverage Diff             @@
##             main    #1293      +/-   ##
==========================================
- Coverage   85.74%   85.66%   -0.09%     
==========================================
  Files          52       52              
  Lines       10946    11114     +168     
==========================================
+ Hits         9386     9521     +135     
- Misses       1560     1593      +33