[OpenLayers-Users] Highlight a polygon ,returned in a search

Joice bjoice at firstam.com
Mon Oct 22 04:45:24 EDT 2007


How can a polygon be highlighted (or filled with a different color , than
other polygon) which is returened by the WFS search result. Eg. Topp.states
:  when I put Texas in the textbox and click on Search Button , the map
zooms to that texas state area with WFS . That is working fine. I also want
this texas polygon to be highlighted. How can it be done.
I tried using json format , but it didn't visualize the output.
The code on the search button is :
function searchFunction(searchkey)
{
	document.getElementById("point").style.display = 'none';
 if (searchkey == "A")
 {      
			fullExtent();
			}
   if (xmlhttp !=null)
   {
      xmlhttp.abort();
      xmlhttp = null;
   }

   clearPopupTimer();

  URL  = "http://"+SERVERHOSTNAME+"/geoserver/wfs/GetFeature";

  XML  = '<?xml version="1.0" encoding="UTF-8"?>'+"\n";
  XML += '<wfs:GetFeature service="WFS" version="1.0.0"'+"\n";
  XML += '  outputformat="json"'+"\n";
  XML += '  xmlns:tiger="http://www.openplans.org/tiger"'+"\n";
  XML += '  xmlns:wfs="http://www.opengis.net/wfs"'+"\n";
  XML += '  xmlns:ogc="http://www.opengis.net/ogc"'+"\n";
  XML += '  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'+"\n";
  XML += '  xmlns:gml="http://www.opengis.net/gml">'+"\n";
  XML += '  '+"\n";
  XML += '  <Query typeName="topp:states">'+"\n";
  XML += '     <ogc:Filter>'+"\n";
  XML += '		<ogc:PropertyIsEqualTo>'+"\n";
  XML += '          <ogc:PropertyName>STATE_NAME</ogc:PropertyName>'+"\n";
  XML += '			 <ogc:Literal>'+searchkey+'</ogc:Literal>'+"\n";
  XML += '		</ogc:PropertyIsEqualTo>'+"\n";
  XML += '     </ogc:Filter>'+"\n";
  XML += '   '+"\n";
  XML += '  </Query>'+"\n";
  XML += '</wfs:GetFeature>'+"\n";

  getXML(URL,XML,XMLProgressSearchFunction);
	
}

I tried with( XML += '  outputformat="json"'+"\n";) all format .
Is it possible to use openlayer to achieve this.
Thanks,
-- 
View this message in context: http://www.nabble.com/Highlight-a-polygon-%2Creturned-in-a-search-tf4669536.html#a13339037
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list