[mapserver-users] Why queryByPoint returns neighbour object insteadof clicked object

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Sep 8 09:42:47 EDT 2008


You could try plotting your query point on the map to help visualize things I
suppose. Perhaps the PixelToGeo function is off.

One things I'd try is taking the output from that function and using it to formulate
a query to the CGI. That would allow you to compare your results against another
source. You can do this at the command line. The form would be:

  mapserv "QUERY_STRING=map=your.map&mapxy=yourx+youry&qlayer=yourlayer&mode=query"

Steve

>>> shurhen <shurhenv at mail.ru> 09/08/08 8:25 AM >>>
Hello!

Why queryByPoint returns neighbour object instead of clicked object?

For several days I tried to solve this problem, but things are still
where they started. Sometimes selection was correct, sometimes
incorrect. I've noticed if I click in the middle of the object - very
often selection was incorrect (it was highlighted neighbour object),
but if if I click nearer to the vertex - right results go more often.
May be something wrong with projections?

Here is my code example that I've gathered from many sources


            pointObj a_geopointObj = PixelToGeo(m_map, e);

            a_layer.toleranceunits = (int)MS_UNITS.MS_PIXELS;
            double a_tolerance = -1;
            bool a_foundflag = false;
            while (!a_foundflag && (a_tolerance < 100))
            {
                m_map.prepareQuery();
                a_layer.queryByPoint(m_map, a_geopointObj, mapscript.MS_SINGLE, a_tolerance);

                using (resultCacheObj results = a_layer.getResults())
                {
                    textBoxSRCC1.Text = a_tolerance.ToString();

                    a_foundflag = results.numresults > 0;
                    if (!a_foundflag)
                        a_tolerance++;
                }
            }

What I have missed?

And then some, I don't understand why tolerance values "-1" does not
work? Documentation says: "-1" is for MS_PIXELS


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list