I am using the below code to get the BBOX values:

wms = new OpenLayers.Format.WMSCapabilities();
 success: function(e){
  var response = wms.read(e.responseText);
  var capability = response.capability;
  for (var i=0, len=capability.layers.length; i<len; i+=1) { 
  var layerObj = capability.layers[i]; 
  if (layerObj.name === 'cite:'+layers) { 
  var bounds=OpenLayers.Bounds.fromArray(layerObj.bbox).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857") ); 

But I am not getting the exact values, when I debug the code in Firefox it look like this:

enter image description here

I want the BBOX values shown in the above image. Please tell me the code to get that BBOX values.

  • 1
    In the GetCapabilities response what is the actual <BoundingBox SRS="EPSG:3857" minx="..." miny="..." maxx="..." maxy="..."/> values reported for your cite layer? – nmtoken Feb 16 '17 at 8:46
  • is the difference before or after you transform the bbox? – Ian Turton Feb 16 '17 at 8:47
  • after transform iam getting the different values but i want the values shown in the image. Those values(shown in image) and <BoundingBox SRS="EPSG:3857" minx="..." miny="..." maxx="..." maxy="..."/> values are same. – user46218 Feb 17 '17 at 4:09

I have solved it. Thank you for your reply.

var bbox = layerObj.bbox["EPSG:3857"].bbox;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.