How to get Native Bounding Box minx,miny,maxx,maxy using openlayers?

المشرف العام

Administrator
طاقم الإدارة
I am trying to develop GIS application using GEO SERVER and OPEN LAYERS

i want to get bounds from geo server Native Bounding Box data of a layer instead of manually hard code

var map;var key = 0;var fromNo = "";var toNo = "";var colorId = "";var count = 0;function init(){format = 'image/png'; if(map)map.destroy();var bounds = new OpenLayers.Bounds( 8568700.4305088, 1677704.30921461, 9195694.68892519, 2070938.3484273);var options = { controls: [], maxExtent: bounds, maxResolution: "auto", projection: "EPSG:900913", units: 'degrees', minZoomLevel: 0, numZoomLevels:15,maxZoomLevel:15 };var click_ap ;var values = new Array();map = new OpenLayers.Map('map', options); $('.selectionTable tr').each(function() { fromNo = $(this).closest("tr").find(".fromNo").val(); toNo = $(this).closest("tr").find(".toNo").val(); colorId = $(this).closest("tr").find(".colorSelect option:selected").val(); apZoomLevel1 = new OpenLayers.Layer.WMS( "ap", "http://localhost:8090/geoserver/scmapWithSelectColor/wms??request=getCapabilities ", {'layers': 'scMapQuery', viewparams: 'fromNo:'+fromNo+';toNo:'+toNo+';colorId:'+colorId+';', 'transparent': true,isbaselayer:false},{ singleTile: true,opacity: .5 } ); values.push(apZoomLevel1);});click_ap = new OpenLayers.Control.WMSGetFeatureInfo({ url:'http://localhost:8090/geoserver/scmapWithSelectColor/wms', title: 'Identify features by clicking', layers: [apZoomLevel1], queryVisible: true, eventListeners: { getfeatureinfo: function(event) {if (ContentFilterAp(event.text,'hos').length>0){//alert("localitieslevel3"); map.addPopup(new OpenLayers.Popup.FramedCloud( "apZoomLevel1", map.getLonLatFromPixel(event.xy), null, ContentFilterAp(event.text,'hos'), null, true ));} } } });gmap = new OpenLayers.Layer.Google( "Google Streets" );ghyb = new OpenLayers.Layer.Google( "Google Hybrid", {type: google.maps.MapTypeId.HYBRID}); map.addControl(new OpenLayers.Control.Navigation()); map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')})); map.addLayers([gmap,ghyb]); var length = values.length; if(length > 0) { for(i=0;i
 
أعلى