I am working on a collaborative project in Python that uses GDAL/OGR to work with rasters and vectors. There is one function that attempts to project one ESRI Shapefile's coordinate system into another. This is done by creating a coordinate transformation from one spatial reference to another, then reading through the geometries and attempting a Transform, which is then written to an output vector of the desired projection. Read: reprojecting a shapefile.
I've ran across one application where it is desired to "unproject" from UTM Zone 3N (Alaskan Region) to WGS84 (lat/long). Doing this causes distortion and bad extents for the output, where the returned shapefile's polygon stretches from -180 to 180 degrees. I believe the issue is due to the projected shapefile crossing the extents of the -180 degree boundary. To confirm, I broke the projected shapefile into 3 parts, west of -180 degrees, middle at -180 degrees, and east of -180 degrees. When unprojecting west / east to WGS84, the returned shapefiles were as expected, however, the west portion lived at positive 180 and the east portion lived at -180 degrees. The middle portion was returned distorted. To visualize this better I provide 2 photos below, the first being the projected data as explained, and the second being the broken results as just mentioned:
I would like to know the proper way of handling this unprojection in Python using GDAL/OGR. I'm a developer by trade and don't have a thorough understanding of GIS projections. May be similar in ideas to this post: How to stop gdalwarp creating world-spanning outputs near the dateline?