I'm having an issue when using the reprojection system for ShapeFileFeatureSource.
The internal projection of the shapefile I'm trying to reproject is:
+proj=lcc +lat_1=34.03333333333333 +lat_2=35.46666666666667 +lat_0=33.5 +lon_0=-118 +x_0=609601.2192024384 +y_0=0 +ellps=clrk66 +datum=NAD27 +units=us-ft +no_defs
And I'm trying to project to WGS84:
+proj=longlat+ellps=WGS84+datum=WGS84+no_defs
I'm using GDAL to load the internal projection, which works well with this same code for several other shapefiles I have loaded:
OSGeo.OSR.SpatialReference sr = new OSGeo.OSR.SpatialReference( "" );
sr.ImportFromESRI( new string[] { prj } );
string internalProjection = "";
sr.ExportToProj4( out internalProjection );
sr.Dispose();
string externalProjection = Proj4Projection.GetEpsgParametersString( importArgs.Srid );
shapefile.Projection = new Proj4Projection( internalProjection, externalProjection );
shapefile.Projection.Open();
I'm importing into a PostgreSQL database, so I'm using Feature.GetWellKnownText()
to grab the geometry of each feature. However, the geometry is not at all correct and eventually returns shapes that can't be parsed by PostGIS.
Here's an example of the data that is returned:
MULTILINESTRING((-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98,-2.85447048245644E-164 -1.70963895410571E-98))
As you can see, this isn't even close to lat/lon values.
As a check, I looked at the values returned from Feature.GetShape()
and they are the same.
If I reproject this same file to WGS84 before importing it (using Quantum GIS), it imports as it should.
Any ideas?
Thanks,
Chris