[MetaCRS] Coordinate transformation returning NaN

stretch andrew.deklerk at gmail.com
Wed Jul 22 08:08:16 EDT 2009


Hi all

I am following on from a post i made a couple of weeks ago
(here:http://n2.nabble.com/map-coordinates-in-different-coordinate-system-td3224904.html).
It was suggested to post here.

Firstly. I am trying to reproject from 4148 to 2054 (hartebeesthoek94 Lo31).
Much discussion in my previous post, and indeed on other mailing lists (i.e
GDAL) relates to this projection and the fact that it is south orientated.
Let me firstly try and clarify as we have had some discussion around this
very topic on the africa osgeo mailing list.
1. Officially (i think) hartebeesthoek94 used a modified South Orientated
transverse mercator projection
2. Only some surveyors and engineers use this in Cad packages
3. 99% of all GIS users in South Africa do NOT use this South orientated
Transverse Mercator and instead use  the standard transverse mercator (with
Hartebeesthoek/WGS84 datum and WGS84 ellipsoid)

What I am trying to accomplish should therefore NOT rely on support for a
south orientated projection.

Here is my code:

    Proj4js.defs["EPSG:2054"] = "+proj=tmerc +ellips=WGS84 +datum=WGS84
+lon_0=31 +units=m +no_defs"; 
    Proj4js.defs["EPSG:4148"]  = "+proj=longlat +ellps=WGS84
+towgs84=0,0,0,0,0,0,0 +no_defs "; 
    
    var source = new Proj4js.Proj('EPSG:4148');    //source coordinates will
be in Longitude/Latitude
    var dest = new Proj4js.Proj('EPSG:2054');     //destination coordinates 
 
    // transforming point coordinates
    var p = new Proj4js.Point(30.352,-29.623);   //any object will do as
long as it has 'x' and 'y' properties
    Proj4js.transform(source, dest, p);      //do the transformation.  x and
y are modified in place
    alert(p.x);
    alert(p.y);

the alert return "NAN", if i use EPSG:27563 as per the example, the alert
return a correct value

On a further note if i run
cs2cs +proj=latlong +datum=WGS84 +to +proj=tmerc +lon_0=31 +datum=WGS84 
and then enter:
30.352 -29.623
You will get:
-62758.77       -3278498.65 0.00

Which is the correct result:

I would appreciate any assistance in getting my transformation to work
correctly
Regards
Andrew
-- 
View this message in context: http://n2.nabble.com/Coordinate-transformation-returning-NaN-tp3302655p3302655.html
Sent from the MetaCRS Mailing List mailing list archive at Nabble.com.


More information about the MetaCRS mailing list