[Mapserver-users] queryByShape, intersects
Lowell Filak
lfilak at medinaco.org
Fri Jul 9 05:49:53 PDT 2004
The following message was sent by Sylvain Beorchia
<sbeorchia at gi-lemans.fr> on Thu, 08 Jul 2004 18:31:06 +0200.
> Hi list,
>
>
> Here is my problem:
> I want to query a map using object ids + a shape drawn on the
map..ie...i've
> got a list of shape returned from an sql query, adn then, i want to
know if
> those objects are contained in a specific zone of the map, represented
by a
> shape.
> I tried queryByShape to retreive the objects from the shape.. but it
doesn't
> work...look at the way i use to create the shape :
>
> $coord = $HTTP_FORM_VARS["FENCE_COORD"];
> $shapeFence=ms_newShapeObj(MS_SHAPE_POLYGON);
> $line=ms_newlineObj();
> $point=ms_newPointObj();
> $setXY = strtok($coord, ";");
> $first = 1;
> $firstPoint = ms_newPointObj();
> while ($setXY)
> {
> $coordArray = explode("," , $setXY);
> $x = GMapPix2Geo($coordArray[0], 0,$dfWidthPix, $dfMinX,
$dfMaxX,
> 0);
> $y = GMapPix2Geo($coordArray[1], 0,$dfHeightPix, $dfMinY, $dfMaxY, 1);
> $point->setXY($x,$y);
> $line->add($point);
> $setXY = strtok(";");
> if($first == 1)
> {
> $first = 0;
> $firstPoint->setXY($x,$y);
> }
> }
> $line->add($firstPoint);
> $shapeFence->add($line);
>
> @$gpoMap->queryByShape($shapeFence);
>
> Moreover, when i check the bounds of my new created shape, xmin =-1,
> ymin=-1...
> How is it possible regarding of my code ?
>
>
> And then, is it possible to use the funtion Intersect with 2 shapes from
> differents layers, and one got by the getShape function, and the other
> created dynamically.
>
> Thanks for any help.
>
> Sylvain.
>
Sylvain
Just as a starting point:
1) In SWIGMapScript there is a $shapeobj->setBounds that needs called to
set the bounds of a new shape (does anyone know if that is also true for
PHPMapScript?).
2) Is there a template set on the layer you are querying?
3) With newer versions of MapServer there is also a requirement that the
class for the layer containing the dynamic shape contain a style - at
least for drawing.
HTH
Lowell
More information about the MapServer-users
mailing list