Skip to content

Support get/set_coordinates/apply with more than 2 dimensions #131

@jorisvandenbossche

Description

@jorisvandenbossche

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions