PHP MapScript queries

Robert Ofarrell s371538 at student.uq.edu.au
Thu Feb 1 17:31:28 EST 2001


To get your hands on the queryResultObj object you need the following:

In the single layer you need a query object.  Here is an example from one
of my map files:

#	Layer: "pla06037"
LAYER
	NAME "pla06037"
	DESCRIPTION "Places (1995)"
	TYPE POLYGON
	STATUS ON
	DATA "pla06037"

	CLASS
		EXPRESSION  (1 eq 1)
		NAME "pla06037"
		COLOR 150 120 00
		OUTLINECOLOR 0 0 0
	END #Class

	QUERYITEM 'NAME'
	TOLERANCE 0
	QUERY
		EXPRESSION (1 eq 1)
		TEMPLATE ""
	END #Query

END #Layer

Then in the code that you have, you need to do either a queryUsingRect,
queryUsingPoint, queryUsingFeatures or queryUsingShape.

Ex.	$mapQuery = $map->queryUsingPoint($point, MS_MULTIPLE, -1);

The $mapQuery part of the previous expression is the queryResultObj.  From
there you can pull your results.

For your purposes you would need to use a queryUsingRect();

Also take a look at the gmap example that comes with PHP-MapScript as it
gives an example of doing the query with a point on the shapefiles.


On Thu, 1 Feb 2001, Thorsten Fischer wrote:

>
> Maybe I should clarify my question: I already have a
> rectObj, and I got a mapObj with a layer and a shapefile loaded.
>
> What do I have to build into the map file and/or my php mapscript to
> get hold on a queryResultObj that answers the question: what shapes are
> visible in that rectangle?
>
> I am quite clueless at that point right now, and I know there must
> be a - simple? - way to make it work.
>
>
> Thorsten
>
>

Robert O'Farrell
University of Queensland, Brisbane, Australia




More information about the mapserver-users mailing list