[Proj] GDM2000 for Malaysia

Frank Warmerdam warmerdam at pobox.com
Fri May 4 19:01:18 EDT 2007


On 5/4/07, Bjørn Krangnes <bkr at devonor.com> wrote:
> I am trying convert GDM2000 &#8211; MRSO (Peninsular)
> I am using C# and GDAL
> The code look as follows
>
>             stat3 = input.ImportFromProj4("+proj=longlat +ellps=GRS80
> +no_defs  <>");
>             stat4 = output.ImportFromProj4("+proj=omerc +lat_0=4
> +lonc=102.25 +alpha=323.0257964666666 +k=0.99984 +x_0=804671
> +y_0=0 +ellps=GRS80 +units=m +no_defs  <>");
>             xyz[0] = 1.827764875;
>             xyz[1] = 103.64025987222223;
>             xyz[2] = 10.0;
>             OGR.CoordinateTransformation tram = new
> OGR.CoordinateTransformation(input, output);
>             tram.TransformPoint(xyz);
> The result I am getting is : 0.0319005150210526
>             xyz[0] = 0.0319005150210526;
>             xyz[1] = 1.8088637723928358;
>             xyz[2] = 10.0;
>
> The expected result is :
>
> Easting =   627096.132 m
> Northing = 202122.062 m
>
> Anyone who knows what the problem is ?

Bjorn,

Do you check the return result from TransformPoint().  My guess would
be that the code is giving up at some point in the transformtion in which
case it should be returning an error code. Possibly it fails just after
converting the values in degrees to radians?

I tried something close to this with cs2cs before realizing that the
core error is that you are presumably mixing up x and y.  The
xyz[0] should be x or longitude, and xyz[1] should y or latitude.
A latitude of 103 is out of bounds (-90 to 90) so the transformation
terminates.  Unfortunately, when I switch things, I don't get a value
very close to what you are expecting though at least it does produce
a value.

warmerda at iBook% cs2cs +proj=longlat +ellps=GRS80 +to +proj=omerc
+lat_0=4 +lonc=102.25 +alpha=323.02579 +k=0.99984 +x_0=804671
+ellps=GRS80
1.8 103
*       * 0.00
103 1.8
888148.42       -243199.56 0.00

Perhaps this helps a little?

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    | Geospatial Programmer for Rent



More information about the Proj mailing list