[Proj] Coordinate transformation assistance
Bjørn Krangnes
bkr at devonor.com
Fri Apr 13 05:41:14 PDT 2007
Frank,
The expected result is Easting:200049.410 Northing: 199965.743 (sorry,
typo error in my previous answer)
I forgot to mention that I still get returncode 6 from ImportFromEPSG.
Also adding the EPSG file for both ITM and IG.
# IRENET95 / Irish Transverse Mercator
<2157> +proj=tmerc +lat_0=53.5 +lon_0=-8 +k=0.999820 +x_0=600000
+y_0=750000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs <>
# TM75 / Irish Grid
<29903> +proj=tmerc +lat_0=53.5 +lon_0=-8 +k=1.000035 +x_0=200000
+y_0=250000 +a=6377340.189 +b=6356034.447938534 +units=m +no_defs <>
Regards
Bjørn
> Bjørn Krangnes wrote:
>> Hi,
>>
>> 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[3];
>>
>> OGR.SpatialReference inp = new OGR.SpatialReference(null);
>> OGR.SpatialReference outp = new OGR.SpatialReference(null);
>>
>>
>> int stat1 = inp.ImportFromEPSG(2157); // Irish Transverse
>> Mercator
>> int stat2 = outp.ImportFromEPSG(29903); // IrishGrid75
>> Ireland
>>
>> OGR.CoordinateTransformation tra = new
>> OGR.CoordinateTransformation(inp, outp);
>>
>> xyz[0] = 600000.0;
>> xyz[1] = 700000.0;
>> xyz[2] = 22.22;
>>
>> tra.TransformPoint(xyz);
>>
>> I think the problems is with ImportFromEPSG because both istat1 and
>> istat2
>> 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.
>
> Bjørn,
>
> 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
> gcs.csv
> live. In the source distribution they are in the gdal\data directory.
>
> I think you can also do something like:
>
> Gdal.PushFinderLocation("C:\\gdal\\data");
>
> or
>
> 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
> http://lists.maptools.org/mailman/listinfo/proj
>
Bjørn Krangnes
Devonor AS
Telephone: +47 32 29 96 90
Direct Line: +47 32 29 96 91
Mobile: +47 45035640
E-mail: bkr at devonor.com
Web: www.devonor.com
More information about the Proj
mailing list