[Mapserver-users] Converting an image point to a geog. space point
Charlton Purvis
cpurvis at asg.sc.edu
Tue May 13 08:02:50 PDT 2003
Give this a shot.
<?php
// from
http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0204/msg00177.h
tml
//
function pixelToGeo($map,$x,$y) {
# Convert x,y pixel values to georeferenced coords. Returns a
# pointObj.
$minx = $map->extent->minx;
$miny = $map->extent->miny;
$maxx = $map->extent->maxx;
$maxy = $map->extent->maxy;
$dx = $maxx - $minx;
$dy = $maxy - $miny;
$width = $map->width;
$height = $map->height;
$dxpp = (double)$dx/$width;
$dypp = (double)$dy/$height;
$geox = $minx + $dxpp*$x;
$geoy = $maxy - $dypp*$y;
$pointObj = ms_newPointObj();
$pointObj->setXY($geox,$geoy);
return $pointObj;
}
?>
-----Original Message-----
From: Adam Zornes [mailto:zornes at athenic.com]
Sent: Tuesday, May 13, 2003 10:54 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Converting an image point to a geog. space
point
All,
I am trying to query points in php/mapscript. I get a point
from the previous form just fine, but I can't seem to get it to convert
to a proper geog. space point. Does anyone have an example of how to do
this, or just an explanation of how to find the actual map size and the
current map size so that I can work up a formula of my own?
Cheers,
Adam Zornes
More information about the MapServer-users
mailing list