[OpenLayers-Users] Zoom to dinamic WMS Layer

Arnd Wippermann arnd.wippermann at web.de
Fri Jul 23 17:23:41 EDT 2010


Hi,

OpenLayers have no possibilties to get the extent from the WMS. 

You can try to get the extent 

by WMS GetFeatureInfo (if you have a point, that indicates the state) or 
by WFS using the stateId for filter the WFS GetFeature.

and then
map.zoomToExtent(Bounds);

Arnd


-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Gilberto Ramos
Gesendet: Freitag, 23. Juli 2010 15:20
An: users at openlayers.org
Betreff: [OpenLayers-Users] Zoom to dinamic WMS Layer


Hi people, how are you doing?

I'm having troubles to find the way to zoom to a polygon WMS layer that is
dinamically filtered.. 

Let's put this on an example:
You have the USA states map and you have an ID for each state; you define
your WMS layer to something like this:

    var stateID = funcToGetFromURLParam("stateID");

    states = new OpenLayers.Layer.WMS(
        "States", "http://server:8080/geoserver/wms",
        {
            transparent: 'true',
            layers: 'Workspace:states',
            srs: 'EPSG:4326',
            format: 'image/png',
            filter:
"<Filter><PropertyIsEqualTo><PropertyName>ID</PropertyName><Literal>"+stateI
D+"</Literal></PropertyIsEqualTo></Filter>"
        });
    map.addLayer(states);

How would you zoom to this layer (to it's maximum extension, to it's
bounderies.. got what I tried to say?) after is filtered and loaded? I tried
in so many ways but I could not. :S

Thanks for your time folks!

Best regards,

Gilberto Ramos

-----
"For God so loved the world, that he gave his only begotten Son, that
whosoever believeth in him should not perish, but have everlasting life.
For God sent not his Son into the world to condemn the world; but that the
world through him might be saved.
He that believeth on him is not condemned: but he that believeth not is
condemned already, because he hath not believed in the name of the only
begotten Son of God." John 3:16-18
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Zoom-to-dinamic-WMS-Layer-tp5329527p5
329527.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list