[mapguide-users] Transform coordinates from a BC, Canada Albers projection to geographic

Frank Warmerdam warmerdam at pobox.com
Tue Mar 20 00:25:08 EDT 2007

Bruce A wrote:
> I am trying to transform coordinates from a BC, Canada Albers projection to
> geographic and I cannot get the correct results using Mapguide’s WKT and
> transformation capabilities.
> The PHP code below outlines the WKT for the reference systems above (I
> believe) and the transformation code. I have tried several permutations of
> the WKT for the projection without success. I am not certain that the
> definition being used is correct… However, if I use what I believe to be the
> “correct” definition – the transformation produces an error outlined below
> and others although they do not produce an error produce incorrect results.
> “ERROR: The coordinate system transform failed. PROJ4 failed to transform
> the data.
> 	 	$wktGeo = 'GEOGCS["Longitude/Latitude(NAD 83)",DATUM["NAD 83", SPHEROID
> ["GRS 80", 6378137, 298.257222101]], RRIMEM [ "Greenwich", 0.000000 ], UNIT
> ["Decimal Degree", 0.01745329251994330]]';		
> 		$wktAlb = 'PROJCS["BC_Albers",
> GEOGCS["LL83",DATUM["NAD83",SPHEROID["GRS1980",6378137.000,298.257222101]],PRIMEM["Greenwich",
> 0],UNIT["Degree",0.01745329251994330]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["false_easting",1000000.000],PARAMETER["false_northing",0.000],PARAMETER["standard_parallel_1",58.500000],PARAMETER["standard_parallel_2",50.0],PARAMETER["latitude_of_origin",45.0000],PARAMETER["central_meridian",-126.000000],UNIT["Meter",1.00000],AUTHORITY["EPSG","3005"]]';
> 		//$xProj = $point.X;
> 		//$yProj = $point.Y;
> 		$xProj = 1094382;
> 		$yProj = 448309;
> 		$xLat = 49.05958;
> 		$yLon = -122.8836876;


I tried converting from your geographic to your BC Albers with your
WKT definition and I got:

warmerda at amd64[132]% testepsg -t 1.wkt 2.wkt -122.8836876 49.05958
(-122.883688,49.059580,0.000000) -> (1227954.325206,454269.784357,0.000000)

I notice you refer to xLat, and yLon, shouldn't that properly be the

$xLon = -122.8836876;
$yLat =  49.05958;

The "testepsg" transformation I did is using GDAL/OGR and PROJ from the
current development version while MapGuide uses a somewhat older version.
But I don't know of any obvious recent changes in PROJ.4 or OGR with
regard to handling of Albers Conic Equal Area.

What values are you getting?  How exactly do you expect to get the
projected coordinates you quoted?  BTW, I also tried the following
which should be equivelent using EPSG lookups for NAD83 and BC Albers
and I get the same output, so I think your WKT is fine.

warmerda at amd64[134]% testepsg -t NAD83 EPSG:3005 -122.8836876 49.05958
(-122.883688,49.059580,0.000000) -> (1227954.325206,454269.784357,0.000000)

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

More information about the mapguide-users mailing list