Projection close to global bbox distorts geometries
See original GitHub issueHi,
I noticed that when I reproject a set of polygons in geopandas the polygons get distorted if they are close to the borders of the global coverage. I noticed this behavior when projecting to cylindrical equal area projection, not sure if this more general though. Here’s an example
from shapely.geometry import Point, Polygon
import geopandas as gpd
polys = gpd.GeoSeries([Point(-180,0), Point(0,0), Point(180,0), Point(-180, 90), Point(0, 90), Point(180, 90), Point(-160, 45)])
df = gpd.GeoDataFrame({'geometry': polys, 'df':range(len(polys))}, crs={'init': 'epsg:4326', 'no_defs': True})
df
df.crs
df.geometry = df.geometry.buffer(5)
df.plot()
wgs84 = {u'datum': u'WGS84', u'no_defs': True, u'proj': u'longlat'}
cea = {u'datum': u'WGS84', u'lat_ts': 0, u'lon_0': 0, u'no_defs': True, u'proj': u'cea',u'units': u'm', u'x_0': 0, u'y_0': 0}
dfcea = df.to_crs(crs=cea).copy()
dfcea.crs
dfcea.plot()
Not sure if this is caused by the way the geometry is treated here or in shapely or geos. I imagine the solution would require an intersection with the global bbox first and then a reprojection. E.g.
bbox = gpd.GeoSeries([Polygon([(-180, 90), (180,90), (180, -90), (-180,-90)])])
dfbbox = gpd.GeoDataFrame({'geometry': bbox, 'gbbox':0}, crs={'init': 'epsg:4326', 'no_defs': True})
dfint = gpd.tools.overlay(df, dfbbox)
dfint.plot()
dfint.to_crs(crs=cea).plot()
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (16 by maintainers)
Top Results From Across the Web
Squashing the Globe | Bending Lines
Every projection distorts the original geometry of the curved, three-dimensional earth in some way. Since we're so used to seeing projected maps of...
Read more >UserWarning when trying to get centroid from a polygon ...
The issue is that the different projections distort distances near the poles in different ways. The default centroid relies on math based on ......
Read more >Choose the right projection | Learn ArcGIS
Learn how different projections distort the world in different ways. 5 minutes. Map global analysis results. Search for an equal area projection. 15...
Read more >Managing Projections — GeoPandas 0.12.2+0.gefcb367.dirty ...
The Coordinate Reference System (CRS) is important because the geometric shapes in a GeoSeries or GeoDataFrame object are simply a collection of coordinates...
Read more >ee.Geometry.BBox.bounds - Earth Engine - Google Developers
The maximum amount of error tolerated when performing any necessary reprojection. proj, Projection, default: null, If specified, the result will be in this ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Sieboldianus, what you have outlined in your example is similar to the internal logic of the
to_crs()method in geopandas.This is addressed in the master branch currently and will no longer be an issue in version 0.7.0.