Query by point
Eric Bridger
eric at GOMOOS.ORG
Tue Jan 18 06:14:31 PST 2005
On Mon, 2005-01-17 at 17:02, Jeff Portwine wrote:
> > The error message looks like Mapserver is assuming your layer is a shape
> > file layer but that > the DATA section of your layer has no shape file
> > name associated with it. What type of
> > layer is it you're attempting to query?
>
> I'm trying to query a points layer. I read a bunch of long/lat
> coordinates from a database and have it plot dots on my map at those
> locations. I want to be able to click on those and bring up information
> about those points, or ideally link to another web page. I thought I
> could just query that point and if they were clicking on one of the "points"
> i had plotted bring up that information, otherwise just output "no location
> found" or something.
>
> I guess I really don't understand how to do a query, and the documentation
> on it just doesn't make anything clear at all... and I am having trouble
> finding any examples of this sort of thing. The GD_Demo does something
> like this but I can't seem to find the code that does it, or I may just not
> be looking for the right thing and missing it.
Jeff,
The problem is that mapserver won't query a layer which doesn't have a
valid DATA source set. I guess that make sense in most cases. There are
two work arounds.
1) Use VirtualSpatialData. I've never used this so can't offer any
additional advice. See:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?VirtualSpatialData
2) Trick mapserver by not only drawing your point using: $point->draw()
but also add your point as a feature to the map: $layer->addFeature().
Features are queryable and mapserver will return whatever numeric shape
index you use when creating the shape. I've never tried this with PHP
Mapscript but use if often with Perl Mapscript and I believe it should
work with PHP. For the Perl example see:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples42ex1
The above script works with 4.4.1.
Eric
More information about the MapServer-users
mailing list