Currently, the apply function (based on the get_coordinates / set_coordinates functions), explicitly states it is only for 2 dimensions and others will be dropped:
|
def apply(geometry, transformation): |
|
"""Returns a copy of a geometry array with a function applied to its |
|
coordinates. |
|
|
|
All returned geometries will be two-dimensional; the third dimension will |
|
be discarded, if present. |
However, for using this function for coordinate transformations in GeoPandas, we need to be able to work with more than 2 dimensions (at least right now with Shapely, that is supported).
@caspervdw do you remember if there was a fundamental reason this could not be done, or rather to keep the initial PR simpler?
I suppose the main problem is that there is no guarantee that all geometries in the array will have the same number of dimensions.
However, I suppose there could be an option to specify how many dimensions should be used, and then in get_coordinates, those geometries that have less dimensions as the specified dimension can be filled with 0's or nan's for those missing dimensions?
Currently, the
applyfunction (based on theget_coordinates/set_coordinatesfunctions), explicitly states it is only for 2 dimensions and others will be dropped:pygeos/pygeos/coordinates.py
Lines 7 to 12 in b176e29
However, for using this function for coordinate transformations in GeoPandas, we need to be able to work with more than 2 dimensions (at least right now with Shapely, that is supported).
@caspervdw do you remember if there was a fundamental reason this could not be done, or rather to keep the initial PR simpler?
I suppose the main problem is that there is no guarantee that all geometries in the array will have the same number of dimensions.
However, I suppose there could be an option to specify how many dimensions should be used, and then in
get_coordinates, those geometries that have less dimensions as the specified dimension can be filled with 0's or nan's for those missing dimensions?