[OpenLayers-Users] is there really no way to get the layer extent
from wms layers?
Greg Allensworth
gregor at greeninfo.org
Mon Aug 15 12:31:24 EDT 2011
On 8/15/2011 5:53 AM, Andreas Hocevar wrote:
> For WMS, all you get is the layer extent advertised in the
> GetCapabilities document. This is what is explained in the
> 2nd post you linked.
Yep, Andreas is entirely right. That's how I'd do it.
Use OpenLayers' Request.GET to download the WMS server's capabilities
document. Then use Format.XML to parse the XML and get the extent of the
layer.
For convenience, you could store these as new attributes within the
Layer.WMS instance:
trafficlayer.wmsbbox = new OpenLayers.Bounds(1,2,3,4)
And call them up similarly:
<checkbox onClick="map.zoomToExtent(trafficlayer.wmsbbox)" />
--
Greg Allensworth, Web GIS Developer
BS A+ Network+ Security+ Linux+ Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510 San Francisco CA 94104
PH: 415-979-0343 x302 FX: 415-979-0371 email: gregor at greeninfo.org
Web: www.GreenInfo.org www.MapsPortal.org
Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org
More information about the Users
mailing list