[mapserver-users] Querying by attributes

Bistrais, Bob Bob.Bistrais at maine.gov
Thu Sep 13 11:18:06 PDT 2012


I'm sorry guys, this should be basic querying and I ought to have figured it out, but I'm stuck.  I'm trying to get a basic query of a shapefile-based layer.  For testing, I hard-coded some parameters to see if it will work.  But try as I might, my searches return 0 results even though I know results should be returned.
I'm on MapServer 6.0.2.  Here is the code:

$map = ms_newMapObj('/ms4w/apps/geoparcels/maps/parcels.map');
$layer = $map->getLayerByName("parcels");
$expression = "'[TOWN]' == 'Acton'";
//perform query
                $layer->queryByAttributes("TOWN",$expression,MS_MULTIPLE);

    if($layer->getNumResults() > 0) {
      echo "results found";
    }
    else{
      echo "no results found";
    }

-What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120913/306caad1/attachment.html>


More information about the mapserver-users mailing list