[Chameleon] Convert Map click to LatLong

Jason Fournier jfournier at dmsolutions.ca
Tue Aug 23 21:15:38 EDT 2005


Joanne,

Are -763099.839836, 4721502.26087 the correct coordinates of Halifax for 
your native projection?

Would it be possible to post your widget code to the list?

Thanks,
Jay




McGraw, Joanne wrote:
> G'day everyone,
> 
> I am trying to convert the coordinates of a mouse click on my map to 
> lat/long and am getting some very wrong results. I am using the code
> below in a widget's phtml.
> 
> The actual projection returned by the Map object's getprojection() is 
> commented below the call. The projection x,y values returned by the 
> Pix2Geo calls are: -763099.839836, 4721502.26087. I am actually 
> clicking in the vicinity of Halifax, Nova Scotia on my map and expect 
> to end up with latitude, longitude values: 44.9n, 63.5w (-ish). I am 
> getting values of: 32.5, -99.3.
> 
> There's gotta be something I'm missing in here, but I've searched the
> Chameleon and MapServer archives for clues and haven't found any. 
> There was some discussion about ensuring I am using the current (vs. 
> the original) map extents, but I believe I am.
> 
> Anybody have any ideas?
> 
> Cheers,
> jtm
> 
> 
> $oMap = $oMapSession->oMap;
> $szMapProj = $oMap->getprojection();
> // +proj=lcc +lat_0=0 +lat_1=49 +lat_2=77 +lon_0=-91.8666 +datum=NAD83
> 
> $aszMinMax = explode(";", $_FORM["NAV_INPUT_COORDINATES"]);
> $adMin = explode(",", $aszMinMax[0]);
> 
> $nGeoClickX = Pix2Geo($adMin[0], 0, $oMap->width, $oMap->extent->minx,
>                       $oExt->maxx, 0);
> $nGeoClickY = Pix2Geo($adMin[1], 0, $oMap->height, $oMap->extent->miny,
>                       $oExt->maxy, 1);
> 
> // nGeoClickX, nGeoClickY : - -763099.839836, 4721502.26087
> 
> reprojectPoint($nGeoClickX, $ nGeoClickY, $szMapProj, "+proj=latlong
> +datum=NAD83");
> 
> // nGeoClickX, nGeoClickY : -99.2798739088, 32.5284181064
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
________________________
Jason Fournier

DM Solutions Group Inc.
jfournier at dmsolutions.ca
www.dmsolutions.ca
613.565.5056 x18


More information about the Chameleon mailing list