spatialdata
spatialdata copied to clipboard
Models: mixed types for the same shape column
Right now in the schema we don't check if a GeoDataFrame shapes object contains mixed types.
I would allow only the following two cases:
- [ ] The geometry column is only made by
Point, no other types allowed; - [ ] The geometry column is made by
Polygonsand/orMultipolygons.
A function to check this is the following, we could out it in the validation schema, or if is expensive, just put it somewhere in the utils:
from geopandas import GeoDataFrame
from typing import Any
def get_geoseries_types(gdf: GeoDataFrame) -> set[Any]:
types = set()
geom = gdf.geometry
for i in range(len(geom)):
x = geom.iloc[i]
types.add(type(x))
return types
- [ ] Finally, we should update the design doc with the above assumptions.