Select Polygon per mouse click, queryByPoint? -- using C# MapScript

Tamas Szekeres szekerest at GMAIL.COM
Tue Aug 22 05:08:40 EDT 2006


Hi Zhonghai,

I suggest the following steps to be implemented.

1. Obtain the bounding rectangle of the resulted shape (shapeObj.bounds)
2. Transform the rectangle from the layer coordinates to the map
coordinates (shapeObj.project)
3. Apply a linear transformation to transform the rectangangle into
the image coordinates.
4. mapObj.zoomRectangle

Tamas


2006/8/22, Zhonghai Wang <zhonghaiw at gmail.com>:
>
> Hi guys,
>
> I have one case here to select a polygon per mouse click, I just wonder if
> someone has ever done something like this. The Situation is:
>
> I have one layer, which contains several polygons, for example, a map layer
> contains all the states of a country, if the user click one of the polygon
> region, the map will be zoomed to this polygon region with a proper map
> scale, it means that this region will be highlighted and be zoomed to the
> whole map window.
>
> Is it possible?
>
> I've tried with queryByPoint, but it's not possible to set the buffer, since
> the size of each polygon region differs.
>
> thanks for any information.
>
>
> Zhonghai



More information about the mapserver-users mailing list