[mapserver-users] Query By Multiple Attributes ???

Mir Mahammed Hussain Hashmi tohashmi at gmail.com
Tue Feb 19 01:11:24 PST 2008


Hello Readers,

I am trying to generate a map with a hilited parcel.  The parcel
should be an id that belongs to [BuildingNo & AddNo & ZipCode.]

I am using a FILTER expression as below to get the feature id, but it
always returns a zero i.e no records .... I tried to frame my
expression as suggested in the link .. but still no results...

http://mapserver.gis.umn.edu/docs/howto/msexpressions

any suggestions or hints plz ???

$oLayer->setFilter("([LOCATIONX]=3166 AND [ZIPCODE]=13711 AND
[LOCATIONY=6154])");

if ($oLayer->getNumResults() > 0 )
               {
	 $oLayer->open();
                   $oResult = $oLayer->getResult( 0 );
	
	  $oShape = $oLayer->getShape($oResult->tileindex,$oResult->shapeindex );
	  $aValues = $oShape->values;

	  $aFeatureID = $aValues['OBJECTID_1'];  //Feaure id to hilite parcel
 	   //------- FREE SHAPE 	
	   $oShape->free();
	   $oLayer->close();

	   //------- Set the Layer class expression
	   $oLayer=$oMap->getLayerByName("parcels_selection");
	   $oLayer->set("status", MS_ON);
	   $oClass = $oLayer->getClass(0);
	   $oClass->setExpression($aFeatureID);

	   //------- Draw the map
	   $oImg = $oMap->draw();
	   $oImg->saveImage($aMapPath);
	   $oImg->free();
	    echo "<img
src='http:/"."/hqit4000/SPMapCache/_temp/PDA/".session_id()
.".".$aMapFormat."'>";
   }

thanks & regards



More information about the MapServer-users mailing list