4

Background:

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.

Question:

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:

Projected Shapefile showing the individual segments tested

Unprojected results showing how transform was done

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?

  • 1
    I like the concept of an unprojection but I think you mean reprojection. – nmtoken Sep 29 '16 at 7:47
1

I can't see the images you provided atm but from your description I assume you're trying to use something similar to this: http://pcjericks.github.io/py-gdalogr-cookbook/projection.html#reproject-a-geometry

I haven't tried it but a quick search landed this, which uses an alternative method to reproject shapefiles using GDAL/OGR: http://geoinformaticstutorial.blogspot.com/2012/10/reprojecting-shapefile-with-gdalogr-and.html

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.