[mapserver-users] Mapscript whichshapes attribute query

J.J. Schlafley jjschlafley at yahoo.com
Thu Jul 3 10:45:59 EDT 2008


Below is a code snippet/////////////////////////////////
$map_path="C:/Program Files/ms4w/apps/wms/";
        
$map = ms_newMapObj($map_path."ICWMS2.map");
$map->setextent(586892.5,339611.094,593679.063,346206.156);
 
$image=$map->draw();
       $layer = $map->getLayerByName('PARCELS');
       $status = $layer->open();
       
       $status = $layer->whichShapes($map->extent);
       while ($shape = $layer->nextShape()) 
           {
             
             echo $shape->toWkt();   
             
           }
       $layer->close();
       
       $image_url=$image->saveWebImage();
echo(" <IMG SRC=$image_url >");
////////////////////////////////////////////////////////////////////
Below is the layer in the map file//////////////////
LAYER
 TYPE POLYGON
 STATUS ON 
 NAME "PARCELS"
 FILTERITEM "PIN"
 FILTER "84-035-40-001-00"
 DATA "Par.shp"
 CLASS
  STYLE
   OUTLINECOLOR 0 0 255
   SIZE 4
  END
 END
END
///////////////////////////////////////////////////////////////////
If I remove the FILTER on the layer, the whichshapes code works correctly and returns all the shapes within the extent.
Let me know what you think.
Thanks.



----- Original Message ----
From: Steve Lime <Steve.Lime at dnr.state.mn.us>
To: mapserver-users at lists.osgeo.org; jjschlafley at yahoo.com
Sent: Thursday, July 3, 2008 10:00:19 AM
Subject: Re: [mapserver-users] Mapscript whichshapes attribute query

No, just setting the filter in the mapfile should suffice. Do you have a code snippet?

Steve

>>> "J.J. Schlafley" <jjschlafley at yahoo.com> 07/03/08 8:51 AM >>>
If I have a FILTER and FILTERITEM set in my map file for a layer....when I call a whichshapes on that layer I get zero shapes.  Comparatively, if I run a map draw, the FILTER works correctly and draws the shapes that meet the criteria.  Do I need to use mapscript to set the filter or something? Thanks



----- Original Message ----
From: Steve Lime <Steve.Lime at dnr.state.mn.us>
To: mapserver-users at lists.osgeo.org; jjschlafley at yahoo.com
Sent: Wednesday, July 2, 2008 9:29:06 PM
Subject: Re: [mapserver-users] Mapscript whichshapes attribute query

Which shapes applies the layer FILTER definition if it exists. That FILTER must be set prior to calling whichshapes.

Steve

>>> "J.J. Schlafley" <jjschlafley at yahoo.com> 07/02/08 12:22 PM >>>
The mapscript documentation for the method (LayerObj) whichshapes claims you can quote: "Performs a spatial, and optionally an attribute based feature search."  How and where is the attribute based search query included in this method? 
JJ


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080703/35b81e29/attachment.html


More information about the mapserver-users mailing list