[mapserver-users] Why queryByPoint returns neighbour object instead of clicked object

shurhen shurhenv at mail.ru
Mon Sep 8 08:27:20 EDT 2008


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




More information about the mapserver-users mailing list