[mapserver-users] I have a question about the GMapPix2Geo function (listedbelow).
Yewondwossen Assefa
assefa at dmsolutions.ca
Wed Oct 23 11:12:53 PDT 2002
Do you have any values for which the function fails ?
PS : this function has been used in the GMap demo for some time now. I do not think that there is a problem with it but ...
Later
Debbie Pagurek wrote:
> I have a question about the GMapPix2Geo function (listed below).
> I have a map of the world showing in lat long. The below function only seems to work if I am zoomed IN really far and it doesn't work if I am at the full extent of the map (minx=-180, maxx=180, miny=-90, maxy=90)
>
> Can anyone comment on this? I wanted to build a mouseover function that will show the coordinates of the mouse position in the windows status bar.
>
> Thanks,
> D. Pagurek
>
> /************************************************************************/
> /*function GMapPix2Geo($nPixPos, $dfPixMin, $dfPixMax, $dfGeoMin,dfGeoMax, $nInversePix) */
> /* Utility function to convert a pixel position to geocoded position. */
> /* */
> /* The parameter $nInversePix could be set to 1 for Y pixel coordinates where the UL > LR. Else set to 0. */
> /************************************************************************/
> function GMapPix2Geo($nPixPos, $dfPixMin, $dfPixMax, $dfGeoMin, $dfGeoMax, $nInversePix)
> {
> // $nPixPos : pixel position (X or Y)
> // $dfPixMin, $dfPixMax : Pixel minimum and maximum (X or Y) of your map on the screen (should be 0 to xxx)
> // $dfGeoMin, $dfGeoMax : Geographic coordinate min max (X or Y) of your map on the screen
>
> $dfWidthGeo = $dfGeoMax - $dfGeoMin;
> $dfWidthPix = $dfPixMax - $dfPixMin;
>
>
> $dfPixToGeo = $dfWidthGeo / $dfWidthPix;
>
> if (!$nInversePix)
> $dfDeltaPix = $nPixPos - $dfPixMin;
> else
> $dfDeltaPix = $dfPixMax - $nPixPos;
>
> $dfDeltaGeo = $dfDeltaPix * $dfPixToGeo;
>
> $dfPosGeo = $dfGeoMin + $dfDeltaGeo;
>
> return ($dfPosGeo);
> }
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056 (ext 14)
Fax: (613) 565-0925
----------------------------------------------------------------
More information about the MapServer-users
mailing list