-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
antimeridian_cutting problem #801
Comments
@dzanaga does this problem persist with newer versions of fiona and GDAL? Have you checked to see if this is a consequence of enabling partial reprojection? |
@sgillies I still have to test this with the latest GDAL and fiona. No I haven't checked if this is caused by enabling partial reprojection. Will check it out. |
The problem persists. To reproduce:
Versions:
I also had to switch to using
See the commented out part of the example. |
Found the workaround to the CRS issue in #580, and that works, but shouldn't that be implemented already? |
For some reason, three triangles are created instead of one triangle (lon +180) and one square (lon -180). I think maybe it has to do with the fact that the upper left point is projected to exactly the antimeridian line at lon = -180 and lon = +180 which means that the polygon on the right will have only 3 vertices, and it's correctly generated, but then somehow it creates two triangles also on the left instead of one square.
|
@dzanaga thanks for the update. Let me see if I understand -- |
That's what I thought but it's not like that, I projected the sinlge points:
So it seems that only one vertex is reprojected to the other side and no points end up on the antimeridian line. |
@dzanaga although I don't understand why we see a problem with GDAL 2.4, I see a solution for you with GDAL 3+. Use OGC:CRS84 (strictly long/lat coordinate order) instead of EPSG:4326 (which is strictly speaking lat/long coordinate order). GDAL versions before 3.0 used to treat these as more or less the same reference system. For GDAL 3.0 they are different. We have a bug in Fiona 1.8.x (#919) such that we don't do the same thing at the antimeridian as ogr2ogr does for EPSG:4326. But if you use OGC:CRS84, which is strictly more correct, you'll get the results you expect. from fiona.transform import transform_geom
from shapely.geometry import mapping, shape, box
def base_transformer(geom, src_crs, dst_crs):
return shape(
transform_geom(
src_crs,
dst_crs,
geom=mapping(geom),
antimeridian_cutting=True,
)
)
geom = box(199980., 2890200., 309780., 3000000.)
print(base_transformer(geom, "EPSG:32601", "OGC:CRS84")) The result is a two part multipolygon, one part a triangular sliver, one a quadrilateral. |
I'm sorry it took me so long to realize that this is another manifestation of #919. Thank you so much for the data and code! |
@dzanaga is this bug still present in Fiona 1.8.16? |
Potentially related: OSGeo/gdal#2942. |
Following the discussion at geopandas/geopandas#448 I was trying the solution proposed by @snowman2 (based on fiona) to transform the Sentinel 2 epsg zone 32601 to lat lon:
Projecting it to lat lon using the solution proposed yields this:
which looks good overall, except for one tile (01RBK):
(zoom on the left side)
(zoom on the right)
There seems to be an issue with the projection of the bottom left point.
To reproduce:
Env info:
The text was updated successfully, but these errors were encountered: