[OpenLayers-Dev] zoon and highlight the selected feature

urvashi reedhishuklaengg at gmail.com
Tue Nov 2 04:53:08 EDT 2010

i am very new to the open layer.I am passing the state name from one aspx
page to other to select the state what is required.I have a layer of state
boundary.the state is getting selected but only the selected state is
visible>suppose if the ASSAM is passed then only it is visible rest all
state are not visible.i want that assam should be highlighted with different
color and get zoomed.But the other state should also be visible.

String AnchorLink;
           AnchorLink = "<" + "a href=map.aspx?state=" + statename +
"&year=" + year + "&test="+test+"  target=_blank'>VIEW MAP ";

function init()
               // if this is just a coverage or a group of them, disable a
few items,
               // and default to jpeg format
               format = 'image/png';
                   document.getElementById('filterType').disabled = true;
                   document.getElementById('filter').disabled = true;
                   document.getElementById('antialiasSelector').disabled =
                   document.getElementById('updateFilterButton').disabled =
                   document.getElementById('resetFilterButton').disabled =
                   document.getElementById('jpeg').selected = true;
                   format = "image/jpeg";

               var bounds = new OpenLayers.Bounds(2811389.012,
2178366.382,5679309.37, 5443435.221);
               var options = {controls: [], maxExtent:
bounds,maxResolution: 12754.175152343749,projection: "EPSG:4326",units:
               map = new OpenLayers.Map('map', options);
               // setup tiled layer
               tiled = new OpenLayers.Layer.WMS("state - Tiled",
               {srs: 'EPSG:4326', width: '449', styles: '',height:
'512',layers: 'lulcstate:state',format: format,tiled: 'true',tilesOrigin :
map.maxExtent.left + ',' + map.maxExtent.bottom},
               { buffer: 0,isplayOutsideMaxExtent: true}


               // setup single tiled layer
               untiled = new OpenLayers.Layer.WMS(
                   "state - Untiled",
                       srs: 'EPSG:4326',
                       width: '449',
                       styles: '',
                       height: '512',
                       layers: 'lulcstate:state',
                       format: format
                   {singleTile: true, ratio: 1}


               map.addLayers([untiled, tiled]);

               var filterType = 'cql';
               var filter = document.getElementById('textstate').value;
               var filtervalue="STATE='"+filter+"'";

               // by default, reset all filters
               var filterParams = {
                   filter: null,
                   cql_filter: null,
                   featureId: null
               if (OpenLayers.String.trim(filter) != "") {
                   if (filterType == "cql")
                       filterParams["cql_filter"] = filtervalue;

               // merge the new filter definitions
View this message in context: http://osgeo-org.1803224.n2.nabble.com/zoon-and-highlight-the-selected-feature-tp5696280p5696280.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list