EuroCrops
EuroCrops copied to clipboard
Drop Z dimension
The LT and the SI dataset have a 'Z'-dimension, which seem to be 0 for all values, and causes an error when ingesting these datasets into the geoDB. Suggestion: drop the dimension. Implementation could look like this (with gdf being an instance of geopandas.GeoDataFrame):
import shapely
def remove_z(gdf):
new_geom_values = []
for value in gdf['geometry'].geometry.values:
new_geom_values.append(shapely.ops.transform(lambda *args: args[:2], value))
new_geom = geopandas.array.GeometryArray(numpy.asarray(new_geom_values, dtype=shapely.geometry.polygon.Polygon))
new_gs = geopandas.geoseries.GeoSeries(new_geom)
gdf['geometry'] = new_gs
Thank you @thomasstorm for pointing that out and providing the solution as well :+1:
The extra z dimension in the geometry has been removed for LT and SI for the latest HCAT3. Let me know if it's still causing issues :). Thanks.