Querying using mapscript
Daniel Morissette
morissette at dmsolutions.ca
Thu Jan 4 09:24:11 PST 2001
Gert-Jan van der Weijden wrote:
>
> We're trying to query a layer using a mapscript queryUsingPoint.
> According to the documentation this finally (via queryResultObject and
> shapeSesultObject)
> returns a Shape. How can we retrieve the attributes (fieldvalues)
> belonging to this shape.
> Are there mapscript methods to accomplish this, or is this to be done
> using PHP's dBase module ?
>
Gert-Jan,
Yes, you have to use PHP's dBase module to access the attributes. Also
important to note is that PHP dBase record numbers start at 1, but
MapScript's shape indexes start at 0, so when you read your DBase
record, you have to use:
$rec = dbase_get_record_with_names($db, $result->shape+1);
See also the function GMapDumpQueryResults() in gmap75.php3 in the GMap
PHP/MapScript demo for a complete example of dumping attributes of
selected shapes.
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list