How to query for polygon attributes using PHPMapscript?
John
jkim at SCIENCES.SDSU.EDU
Sun Jun 26 21:37:00 PDT 2005
Hi,
I don't understand how a query works using PHP/Mapscript. I've read various
reference manuals but they don't give me a conceptual overview, and I can't
find a good example/tutorial either. I'd like the user to click on a
polygon and get information (attributes) of that polygon.
I think I know how it works *without* PHP: in the map file you define a
template, and in the template file you use [DBASE item name] wherever you
want to refer to the attribute of the selected polygon. For example, if the
polygon has a "landuse" attribute, you can write,
<p>The selected polygon's landuse is [landuse].</p>
Right?
Now, with PHP/Mapscript, you call the function queryByPoint(), which
returns a success or failure value. How do you get the attributes of the
polygon that was clicked?
I'd love to see an example. Also, why do you have to a "mode" parameter to
queryByPoint(), given that queryByPoint() is a method that belongs to a
specific layer object? Isn't the query for that single layer? How can it be
for multiple layers? Thanks.
-John
More information about the MapServer-users
mailing list