Wednesday 5 June 2019

geoserver - How to get layer extent in OpenLayers or zoom to WMS layer extent?



I have added WMS layers using follow:


basemap = new OpenLayers.Layer.WMS( "Layer Name1",
"http://localhost:8080/geoserver/wms/workspacename", {layers: 'workspacename:layername'} );
utility = new OpenLayers.Layer.WMS( "Layer Name2",
"http://localhost:8080/geoserver/wms/workspacename", {layers: 'workspacename:layername', transparent:"true"}, {isBaseLayer:false} );

Now I want to get zoom to my utility layer, How can I?


I have tried as following:


map.zoomToExtent(utility.getDataExtent());


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...