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

shurhen shurhenv at mail.ru
Tue Sep 9 23:45:25 PDT 2008


PixelToGeo works fine! I compared mousemove coords with object
coords and they are coincide.

I've tried your script with my data:
mapserv "QUERY_STRING=map=/ms4w/postgis.map&mapxy=1370858+427466&qlayer=rglots&mode=query"

and got following result:

...
<BODY BGCOLOR="#FFFFFF">
msQueryByPoint(): Search returned no results. No matching record(s) found.
</BODY></HTML>

i.e. nothing :(

PS
my map has srid = -1, i.e. nonEarth (right?) May be all matter's in
this

> 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
-------------- next part --------------
An embedded message was scrubbed...
From: shurhen <shurhenv at mail.ru>
Subject: Re[2]: [mapserver-users] Why queryByPoint returns neighbour object	insteadof clicked object
Date: Tue, 9 Sep 2008 18:46:08 +0400
Size: 3220
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080910/13c0196b/attachment.eml>


More information about the MapServer-users mailing list