[Proj] Coordinate transformation assistance
bkr at devonor.com
Fri Apr 13 03:25:44 EDT 2007
I have been trying what you suggested but no luck. I added the code line
"GDAL.gdal.SetConfigOption("GDAL_DATA", "D:\\gdal-1.4.0\\data");", also
tried Gdal.PushFinderLocation with no luck before calling ImportFromEPSG.
In this directory is all files from the source distribution data
directory. There is no EPSG file in this directory. I did find one EPSG
file in the source distribution for "proj-4.5.0\nad" catalog.
I copied this file to "D:\\gdal-1.4.0\\data" but still no luck. When
stepping though code line "OGR.CoordinateTransformation tra = new
OGR.CoordinateTransformation(inp, outp);" I get an
"AccessViolationException was unhandled" error.
The expected result is Easting:200049.410 Northing: 200049.410
> Bjørn Krangnes wrote:
>> I am trying to go from Irish Transverse Mercator to IrishGrid75 Ireland
>> using GDAL C# and EPSG codes.
>> The code is like this:
>> double xyz = new double;
>> OGR.SpatialReference inp = new OGR.SpatialReference(null);
>> OGR.SpatialReference outp = new OGR.SpatialReference(null);
>> int stat1 = inp.ImportFromEPSG(2157); // Irish Transverse
>> int stat2 = outp.ImportFromEPSG(29903); // IrishGrid75
>> OGR.CoordinateTransformation tra = new
>> OGR.CoordinateTransformation(inp, outp);
>> xyz = 600000.0;
>> xyz = 700000.0;
>> xyz = 22.22;
>> I think the problems is with ImportFromEPSG because both istat1 and
>> is 6 after execution. How to initialize the EPSG codes ?
>> I am resending this request beacuse I have not had any feedback on my
>> previous request.
> You don't indicate what the transformed result is or why you think there
> is an error. But if ImportFromEPSG() is failing (result 6 is
> OGRERR_FAILURE) then it is likely because the EPSG .csv files aren't
> being found. One way around this is to set the GDAL_DATA environment
> variable to point to the directory where the files like pcs.csv and
> live. In the source distribution they are in the gdal\data directory.
> I think you can also do something like:
> Gdal.SetConfigOption( "GDAL_DATA", "C:\\gdal\\data" );
> though my csharp-gdal-fu is weak.
> Best regards,
> I set the clouds in motion - turn up | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush | President OSGeo, http://osgeo.org
> Proj mailing list
> Proj at lists.maptools.org
Telephone: +47 32 29 96 90
Direct Line: +47 32 29 96 91
Mobile: +47 45035640
E-mail: bkr at devonor.com
More information about the Proj