list of unique values in a shapefile using an attribute query
Pietro Giannini
pgiannini at BYTEWISE.IT
Thu Jun 7 01:09:39 PDT 2007
John,
look:
http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj
for the function queryByAttributes in PHP/Mapscript.
The function accept the 'qstring' parameter, a Mapserver expression
(http://mapserver.gis.umn.edu/docs/howto/msexpressions), but not a SQL
query.
It can be hard to create with PHP a 'unique value' response to popolate
the combo.
I believe the better way to do this is to store the shapefiles in a db,
like PotgreSQL/PostGIS (http://www.postgresql.org/ &
http://www.postgis.org/) and query it with the clause 'GROUP BY' on the
fields you want.
If you are in trouble with postgres let me know
bye
..........................pg
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E
> The documentation for PHP/Mapscript shows that it is possible to query
> by attributes using "queryByAttributes" but I must supply the qstring to
> get a match. Does anyone know of a way to get a list of unique values
> for a given field ?
>
> What I want to do is populate a "select" control (aka combo box) on a
> form with the unique values from a field in a shapefile. I'm
> essentially building a query form for attribute data that is stored in
> shapefiles.
>
> It seems like this shouldn't be too difficult but I'm coming into this
> with a GIS background and am relatively new to php and mapserver. Any
> help will be appreciated.
>
> J.B.
> --
> ---------------------------------------------
> John B. Churchill, M.S. http://alx.al.umces.edu/~jchurch/
> GIS Specialist (301) 689-7109
>
> University of Maryland Center for Environmental Science
> Appalachian Laboratory http://www.al.umces.edu/
> Environmental Science Education http://alese.al.umces.edu/
>
> 301 Braddock Road
> Frostburg, MD 21532
> FAX - (301) 689-7200
>
More information about the MapServer-users
mailing list