Models: mixed types for the same shape column
Open
Nobody has claimed this yet.
element: shapes ▲
needs: triage
priority: low
- Dominant language
- Python
- Stars
- 394
- Forks
- 95
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 7
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the schema validation and utility code for GeoDataFrame geometry columns, then review the proposed get_geoseries_types function and the design documentation. Add validation for Point-only columns or columns containing Polygons and/or Multipolygons, and update the design doc with these assumptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data, documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100