Open jorisvandenbossche opened 3 years ago
One to add - we lose spatial partitions after to_crs
. I am just not sure if we can just reproject the partitions GeoSeries or we risk that some points will fall outside in some corner cases.
I think that in general, that is not guaranteed to work. Basically if reprojected lines are no longer straight lines (which happens for many conversions), a reprojected bounding box will not necessarily contain all points anymore. Quick example:
import shapely
box = shapely.box(0, 40, 20, 60)
poly = shapely.segmentize(poly, 5)
reprojected = geopandas.GeoSeries([box, poly], crs="EPSG:4326").to_crs("EPSG:3035")
from shapely.plotting import plot_polygon
plot_polygon(reprojected[0])
plot_polygon(reprojected[1], color="C1")
We already preserve the spatial partitioning information (
spatial_partitions
attribute) in several places (eg when selecting a subset of the columns in__getitem__
, in theboundary
attribute, with a_propagate_spatial_partitions
helper method). But there are more places where it could either be preserved as is, or preserved in a slightly modified form.Methods where it can be preserved as is:
Methods where it might be relatively straightforward to preserve it in a slightly modified form: