fix: explicitly extract xy coords from 3D-LineString
I've been dealing with some trajectory calculations which end up producing 3D LineStrings as geometry.
I am, however, unable to use geom_map with this kind of GeoDataFrame since plotnine expects xy coordinates and fails when the geometry.coords object contains tuples with a z dimension.
It would also be nice to be able to use the z dimension for some other aesthetics, such as color, for instance. My solution for now has been to generate Point geometries from the LineStrings and use geom_path instead of geom_map, but it would be great if this could be handled directly when passing a LineString geometry.
This little fix makes 3D linestrings not throw an error, but does so by completely disregarding the z dimension. I am not completely sure of how to fix this to be able to use z as an extra aesthetic without explicitly reverting the LineString into Points...
Codecov Report
Merging #570 (cb9fb6b) into master (a81b8f9) will decrease coverage by
0.01%. The diff coverage is33.33%.
@@ Coverage Diff @@
## master #570 +/- ##
==========================================
- Coverage 85.23% 85.21% -0.02%
==========================================
Files 154 154
Lines 9930 9932 +2
Branches 1768 1770 +2
==========================================
Hits 8464 8464
- Misses 949 950 +1
- Partials 517 518 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| plotnine/geoms/geom_map.py | 74.35% <33.33%> (-1.96%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update a81b8f9...cb9fb6b. Read the comment docs.
There isn't a way to map to the z coordinate. The key issue is, the mapping translates to one aesthetic value for each entry in the dataframe, but for 3-d lines then each entry has a variable number of z coordinates!
Though I think with some good thought you may be able create a non-standard custom geom that does that.