[mapserver-users] Get the nearest layer with mapscript...

Paul james pauljame at gmail.com
Wed May 20 07:53:45 PDT 2009


Hi Steve!
I didn't know that mapObj could call queryByPoint as well ... Thanks...
But, How can I get the feature selected after query ?

Using LayerObj I did that (using layer.getNumResults() )

if (_layer.queryByPoint(MapaObj, _point, 0, -2) == 0)
            {
                for (int i = 0; i < _layer.getNumResults(); i++)
                {
                    resultCacheMemberObj _result = _layer.getResult(i);

                    return _result.shapeindex.ToString();
                }
            }

How can I do that using MapObj ?

thanks!


On Wed, May 20, 2009 at 10:51 AM, Steve Lime <Steve.Lime at dnr.state.mn.us>wrote:

> If you're doing point queries MapServer/MapScript can do this for you.
> You do a
> mapObj.queryByPoint with the MS_SINGLE mode and then the function will
> identify
> the closest feature (considering TOLERANCEs!) in the top-most ACTIVE
> layer.
>
> This site uses this to it's advantage...
>
>  http://www.dnr.state.mn.us/maps/compass.html
>
> A query drops through the layers until a match is hit.
>
> Even with other geometry types based on what was described you can
> probably do
> it pretty easily. You'd use one of the other query methods and then once
> the query
> is done loop through your layer stack backwards (e.g. starting at the
> top) and stop
> when you find one with results.
>
> Steve
>
> >>> Paul james <pauljame at gmail.com> 05/20/09 7:56 AM >>>
> Thanks Pano...
> But It́s not that simple...
> What I need is figure out what LAYER was clicked...
>
> Paul
>
> On Wed, May 20, 2009 at 6:43 AM, Pano Voudouris
> <pvoudouris at gaiocorp.com>wrote:
>
> >  Probably don’t understand what exactly you are trying to achieve here
> but
> > it is not as simple as map.getLayer(0) to get the topmost layer? And
> once
> > you have the layer object use one of the query function to select the
> > record? E.g.  myLayerObj.queryByPoint ?
> >
> >
> >
> > Pano
> >
> >
> >
> > *From:* mapserver-users-bounces at lists.osgeo.org [mailto:
> > mapserver-users-bounces at lists.osgeo.org] *On Behalf Of *Paul james
> > *Sent:* 19 May 2009 21:46
> > *To:* mapserver-users at lists.osgeo.org
> > *Subject:* [mapserver-users] Get the nearest layer with mapscript...
> >
> >
> >
> > Hello guys...
> > I have several layers (lines, points, poly) ...
> > Ím developing a measure tool... User can click on map and I have to
> > select that layer to calculate de Area with postgis...
> >
> >  Ím trying to do that WITHOUT using "LAYER ACTIVE SYSTEM"...
> >
> >  Is That possible using mapscript? How Can I find the nearest and
> toppest
> > layer ?
> >
> > Thanks!
> >
> > Paul
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090520/951ea8d0/attachment.htm>


More information about the MapServer-users mailing list