manaakiwhenua / vector2dggs

DGGS indexer for vector data
https://pypi.org/project/vector2dggs/
GNU Lesser General Public License v3.0
6 stars 0 forks source link

Tool crashing on 3D geometries #21

Open ChocopieKewpie opened 1 year ago

ChocopieKewpie commented 1 year ago

Currently tool doesn't support geometries with a Z component.

ChocopieKewpie commented 1 year ago

Converting with shapely can simply be achieved with:

import shapely
import geopandas as gpd

def _3D_2D(geometry):
    new_geo = []
    for i in geometry:
        i=shapely.force_2d(i)
        new_geo.append(i)
    return new_geo

df = gpd.GeoDataFrame.from_file(some_shape)
df.geometry = _3D_2D(df.geometry)
alpha-beta-soup commented 1 year ago

It would probably need to drop M values too, in the case of XYZM, or XYM. But I've never actually seen an M value on anything but a line, which we don't yet support. (In that case, the M value could become an attribute.)

What we really need is a test suite and then we can throw degenerate and obscure cases at it.

SPlanzer commented 3 months ago

Just ran into this.

PAN-NZ on Lris is Polygon layer (Z),