Assign Data to a point for query with mapscript?
Eric Bridger
eric at GOMOOS.ORG
Wed Sep 1 12:51:47 PDT 2004
On Wed, 2004-09-01 at 14:28, sandnarrows wrote:
> Hello all. I am using mapscript to create a layer object and add a
> series of points that get displayed on the map. Everything is working
> fine. The layer shows up in the legend, points on the map where they
> should be, etc. Is there a way to add data to the points that can be
> returned when the user performs a query?
>
> Searching through the archives I see several examples of using Xbase to
> create/edit dbf files. I don't really want to create a file, the
> information will only exist as long as the user session.
The only data you can get back from a query is the shapeindex. If you
are adding the points to your layer dynamically e.g.
$layer->addFeature($shape);
You should have done a $shape->{index} = $id; first. That $id can be
any numeric value. When you do a:
$layer->queryByPoint();
....
$result->getResult(0);
$id = $result->{shapeindex};
The id will be the one you set above. That can be used to retrieve your
other values, from some lookup table or some database.
There is a Perl example of this approach here:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples42ex1
Eric
More information about the MapServer-users
mailing list