queryByPoint() php/mapscript help?

Gavin Simpson gavin.simpson at UCL.AC.UK
Fri Apr 15 10:50:38 PDT 2005


Dear list,

I'm finally admitting defeat one this one and am asking for some help or
a pointer or two.

I compiled mapscript 4.4.2 on my Fedora Core 3 box, but replaced
php_mapscript.c with the one Camden Daily submitted to bugzilla to fix
the bug that won't allow you to set the index of a shapeObj. Note that I
have also compiled the latest nightly and I get the same behaviour as I
describe below but reverted to 4.4.2 because the nightly was doing some
strange things when drawing polygons.

I am adding points to a layer dynamically from a MySQL database and the
lat/lon stored therein. As well, I am adding point features (lines with
one point) to the same layer and am setting the index for the point so I
can query this layer later. This works fine and I have a zoomable, map
of Europe with the points of my lakes displayed.

When I come to query the layer using queryByPoint(), no matter what I
do, I always end up with the last shape point I added to the layer I'm
trying to query. So I always get 1 back from getNumResults() no matter
where I click on the map - over a point or not, and the returned shape
from getShape() is always the last shape I added.

I can't see how to make this work properly - what am I doing wrong?

If you want to see what I mean, go to
http://ecrc3.geog.ucl.ac.uk/maps/test/europe.phpms select the query
radio button and click on a point - or anything. The debug code will be
displayed next to the map illustrating the problem nicely.

I've posted my PHP code on my webserver as it looks horrible wrapped in
my mailer:
http://ecrc3.geog.ucl.ac.uk/maps/test/query_problem.txt

Here is my map file:

NAME "eurolimpacs"
SIZE 600 600
STATUS ON
SYMBOLSET "/var/www/html/maps/symbols/symbols.sym"
EXTENT -31.290 27.637 50.375 80.765
UNITS DD
SHAPEPATH "/var/www/html/maps/data"

WEB
        IMAGEPATH "/var/www/html/maps/tmp/"
        IMAGEURL "/maps/tmp/"
END

LAYER
        NAME "Europe"
        TYPE POLYGON
        STATUS ON
        DATA "Europe"
        CLASS
                STYLE
                        COLOR 255 255 255
                        OUTLINECOLOR 0 0 0
                        SYMBOL 0
                END
        END
END

LAYER
        NAME "Lakes"
        TYPE POINT
        STATUS ON
        TOLERANCE 0.1
        # Need fake template for querys to work
        TEMPLATE "bogus.html"
        CLASS
                NAME "0"
                STYLE
                        COLOR 255 0 0
                        MAXSIZE 300
                        SYMBOL 'circle'
                        SIZE 5
                END
        END
END

END

Thanks in advance,

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the MapServer-users mailing list