[Mapserver-users] QueryByAttributes - Search Parcels By Owner Name

Jeff Berry jeffb at erlandsen.com
Thu Jan 23 10:54:47 PST 2003


I'm trying to add a query tool to search parcels by owner name, and have the
map highlight and zoom.  However, I'm having trouble getting the query to
work.  Below is a stripped down version of the code.  I print the
$parcelfound variable just to test the query.  I have a textline called
OwnerName for entering parcels owners to search by.  But regardless of what
I enter in that line I come up with the "Parcel Found" everytime, even
though I know the values don't exist in the table.  It seems the OwnerName
variable is not being used and it's querying with just an empty string.

Also, I have a question about how QueryByAttribute actually works.  In the
examples I've found in the list archive, the only thing being used is
'setfilter'.  Is that filter value being searched for in all columns of the
table? Is it possible to specify one column for it to search in?

if ($HTTP_FORM_VARS["OwnerName"])
  {
    $layer = $gpoMap->getLayerByName("parcels");
    $layer->set("status",MS_ON);
    $layer->setfilter("\"$OwnerName\"");
    $rv = $layer->queryByAttributes($gpoMap, MS_SINGLE);
    if ($rv == MS_SUCCESS)
      {
        $parcelfound = "Parcels Found";
      }
    else
      {
        $parcelfound = "No Parcels Found";

      }
  }

Jeff Berry
Erlandsen & Associates
P.O. Box 2029
Chelan, WA 98816
(509) 682-4189
jeffb at erlandsen.com




More information about the MapServer-users mailing list