[mapserver-users] Query by attributes with PHP/MapScript

Armin Burger armin.burger at libero.it
Wed Oct 2 05:41:31 EDT 2002


Hi all,

I would like to query shapefiles based on their attibutes using
PHP/MapScript, like

  street='mainstreet' and city='newtown'

and then get back all records, including for instance the bounding box
of the shape.

There is the function QueryByAttributes, but as I saw in the mail
archives you have to set a filteritem and then a filter on the layer.
That can only use one field as filteritem. I would need 2 or even more
fields used in the query.

I was thinking about using basic PHP functions for dBase.
Unfortunately the dBase support of pure PHP seems to be very rudimentary
and does not allow queries. There is the Pear DB module, but there is no
documentation to what extent dBase files are supported.

Can anybody who was succesful in this area give me hints how to achieve
slightly complex attribute queries with PHP or PHP/MapScript?

An optimal solution in my opinion would be a query interface in
MapScript that mimics the SQL syntax. Though I don't have any idea how
difficult this would be to implement.


Armin





More information about the mapserver-users mailing list