Hi Ben,<br />Finally I found time to think about this problem: how to
store the geographic coordinates of a mouse clik on the map image, and
thank to you I found a solution; I'm happy to share it.<br /><br />I use
the php-mapscript '$map->cellsize' property to get the delta of a pixel
in projected coordinates, both in x and y.<br /><br />A piece of code:<br
/>        <br /><font
color="#3366ff"><font color="#000000">/* </font></font><font
color="#000000">$_REQUEST['mapimg_x'] and </font><font
color="#000000">$_REQUEST['mapimg_y'] are the </font><font
color="#3366ff"><font color="#000000">coordinates in pixel of the
<INPUT TYPE=IMAGE> of a form on my page that contains the image of
the map.<br /> I multiply the X & Y for the </font></font><font
color="#3366ff">$oMap->cellsize <font color="#000000">to obtain
</font></font> the projected coordinates relatively to the current extent
of the image, and I sum the result to the <font
color="#3366ff">$oMap->extent->minx<font color="#000000">, for the
X, and substract to </font></font><font
color="#3366ff">$oMap->extent->miny <font color="#000000">for the Y,
to obtain the absolute coordinates.</font></font><font
color="#3366ff"><font color="#000000"> */<br /></font></font><font
color="#3366ff">        $newPoint =
ms_newpointobj();<br />       
$newPoint->setXY(($oMap->extent->minx +
($oMap->cellsize*$_REQUEST['mapimg_x'])),($oMap->extent->maxy -
($oMap->cellsize * $_REQUEST['mapimg_y'])));<br /></font><font
color="#3366ff"><font color="#000000"><br /></font></font><font
color="#3366ff"><font color="#000000">/*     I get two new
Projection objects, first is a lat/lon projection and second is projection
of the map.  */<br /> </font></font><font
color="#3366ff">        $olatlonProj =
ms_newprojectionobj("proj=latlong,ellps=WGS84");<br
/>        $osProj =
$oMap->getProjection();<br />       
$omapProj = ms_newprojectionobj($osProj);<br /><br /></font><font
color="#3366ff"><font color="#000000">/* I project the point from the map
projection to the lat/lon projection */</font><br /> </font><font
color="#3366ff">       
$newPoint->project($omapProj,$olatlonProj);<br /><br /></font><font
color="#3366ff"><font color="#000000">/* now I can store the point 
(in this case in a mysql db) */</font></font><br /> <font
color="#3366ff">        $myconn =
mysql_connect("host","usr","pw");<br
/>       
mysql_select_db("db");<br />   
    $sql = "INSERT INTO clickpoints (lon,lat) VALUES
(".$newPoint->x.",".$newPoint->y.")";<br
/>        $res = mysql_query($sql);<br
/>        mysql_close($myconn);<br
/></font><br />Limitedly to the accuracy due of the scale of the map,
result is good. I tried in lat/lon projection and also in Mercator,
Mollweide, Sanson-flamsteed, UTM, orthographic, geostationary satellite
... !<br /><br />cheers<br />...............................pg<br /><br
/><br />-- <br />Pietro Giannini<br />Bytewise srl - Area GIS<br
/>41°50'38.58"N 12°29'13.39"E<br /><br /><br /><br />On
Gio, 14 Dicembre 2006 7:18 am, Ben Madin wrote:<br />> Pietro,<br
/>> <br />> I noticed your question re map coordinates vs pixels.
There may be a<br />> better way, but I compare the proportion of the
pixels with the<br />> proportion of the map extents, for each of X
& Y / Long & Lat /<br />> Easting & Northing or
whatever.<br />> <br />> So,<br />> <br />> if the pixels is
400,200 (when the map is 600 x 300 pixels), then we<br />> are 400/600
of the way from the minimum extent to the maximum extent<br />> on the
map (in this case in both directions).<br />> <br />> I'm sure
someone else will be more articulate about this, or have a<br />>
better idea, which I will be happy to see.<br />> <br />> Actually,
here is a really good resource: (don't forget to have a<br />> look on
the mapserver website first!)<br />> <br />>
http://mapserver.gis.umn.edu/docs/howto/phpmapscript-byexample<br />>
<br />> cheers<br />> <br />> Ben<br />> <br />> <br />>
--<br />> <br />> Ben Madin<br />> REMOTE INFORMATION<br />>
<br />> t : +61 8 9192 5455<br />> f : +61 8 9192 5535<br />> m :
0448 887 220<br />> Broome   WA   6725<br />> <br />>
ben@remoteinformation.com.au<br />> <br />> <br />> <br />>
<br />> <br />>                                       Out here, it pays to know...<br />> <br
/>> <br />> <br />> <br />> <br />> <br />> <br />>
<br />> <br />> <br />