[Mapserver-users] queryByShape, intersects

Sylvain Beorchia sbeorchia at gi-lemans.fr
Thu Jul 8 09:31:06 PDT 2004


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.




More information about the MapServer-users mailing list