Tuesday 25 June 2019

geoserver - Get bounding box of WMS


Is it possible to request the bounding box of a WMS from GeoServer? In my case I have a WMS that I show with L.TileLayer.WMS in a Leaflet map. I like to center and zoom my map to the WMS.



Answer




If you check the response of the GetCapabilities request, you'll see that each layer has a Bounding Box property, which gives its extent.


For example, you'll get something like:


  


You will have to parse this yourself, using pure JavaScript Code. Leaflet doesn't have anything for parsing this.


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...