[mapserver-users] I have a question about the GMapPix2Geo function (listedbelow).
Guillaume SUEUR
guillaume.sueur at khi2.fr
Wed Oct 23 23:44:17 PDT 2002
Can't it be a problem with the equator ? I mean, the function needs to
know if Y are positives or negatives so if you ask for an extent which
includes the equator aree, how can it deals with to kinds of Y ?
Guillaume
Yewondwossen Assefa wrote:
> 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
> ----------------------------------------------------------------
>
>
>
>
--
---------------------------
Guillaume SUEUR
Ingénieur développement SIG
GEOSIGNAL
25bis Avenue Marcel Dassault
31505 TOULOUSE CEDEX 5
----------------------------
More information about the MapServer-users
mailing list