[mapserver-dev] Newby-Question: Select Shapes on the screen

Sumit Sharma sumit321 at hotmail.com
Fri Oct 16 08:08:49 EDT 2009




dimpflmoser wrote:
> 
> Hello everybody,
> 
> I've just started to work/experiment with MapServer and wonder if its
> possible to somehow select items (e.g. Polylines) on the screen by
> clicking at them and get the shapeids or the data of the selected items?
> 
> I've searched the documentation and the archive but didn't find anything.
> (But maybe thats my fault.)
> 
> If so can anybody give a php-mapscript-example, please?
> 
> Thanks Helmut
> 
Hi Helmut,
it is very much possible to select items on screen by clicking at them. I am
using c sharp script to do that hence i will not be able to provide you any
php example but following algo can be used.

1. get mouse click x and y. 
2. convert pixel xy to map point xy... for that you will use map extents,
map height and width to find x and y pixel size and do the conversion.
3. use following function for query 
                public int queryByPoint(OSGeo.MapServer.mapObj map,
OSGeo.MapServer.pointObj point, int mode, double buffer)
    Member of OSGeo.MapServer.layerObj

4. read the result set ....
I think you should be done 



-- 
View this message in context: http://n2.nabble.com/Newby-Question-Select-Shapes-on-the-screen-tp3823708p3835189.html
Sent from the Mapserver - Dev mailing list archive at Nabble.com.


More information about the mapserver-dev mailing list