[Mapserver-users] queryByShape, intersects

Sylvain Beorchia sbeorchia at gi-lemans.fr
Fri Jul 9 09:41:11 EDT 2004


Hi Lowell,

I didn't know that we should use   $shapeobj->setBounds  when creating a new
shape...that's very strange. If so, that may be sometimes not so easy to set
the bounds of a shape which is composed from lot of lines....it's not
difficult, but it's not nice.
Yes there is a template on the layers i query. But not on the layer which
contains the shape (dynamic one).
And my dynamic layer contains a style. I use some Javascript to draw the
shape dynamically, and then i write it in the dynamic layer...and i can see
it very well.
I'm gonna try the setBounds, if there is one, but...

Thanks.

Sylvain


----- Original Message ----- 
From: "Lowell Filak" <lfilak at medinaco.org>
To: "Sylvain Beorchia" <sbeorchia at gi-lemans.fr>;
<mapserver-users at lists.gis.umn.edu>
Sent: Friday, July 09, 2004 2:49 PM
Subject: Re: [Mapserver-users] queryByShape, intersects


> 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