How can i get the extent of the WMS (JS, WFS)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can i get the extent of the WMS (JS, WFS)

springrider
Good morning

I am generating  some maps using Geoserver and Openlayers which contain WMS layers. I can not define in advance what should be the current extent because these WMS layers are generated from geoserver using cql_filter to select some specific polygons from my shapefile.
The goal would be to know automatically the extent of the WMS in order to zoom on it.

This is my current map: and this is what i would like to get automatically:.

Is there a way to obtain by coding the current extent of the WMS (At geoserver or openlayers levels...)??
I saw by using WFS service, we can get the gml:ccordinates (.../wfs?request=GetFeature&typename=fifao:Fao_areas&cql_filter=F_AREA=27), can we extract this information and use it to define the extent of the map??

Thanks for helping me, i start becoming crazy about that point.

Sylvain
Reply | Threaded
Open this post in threaded view
|

Re: How can i get the extent of the WMS (JS, WFS)

Bart van den Eijnden (OSGIS)-2
The way to do this unfortunately is to also perform a WFS request with the
same filter. You can use GeoJSON as the output format. Then you can use the
bbox attribute of the GeoJSON featurecollection (note: this is very new in
Geoserver and has only been added yesterday) as the extent to zoom to.

Btw, it would be a nice enhancement if you could ask Geoserver only for the
bbox of the featurecollection, since you are not interested in the actual
features itself.

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: springrider <[hidden email]>
Naar: [hidden email] <[hidden email]>
Onderwerp: [OpenLayers-Dev]  How can i get the extent of the WMS (JS, WFS)
Datum: 14/11/07 06:54

>
> Good morning
>
> I am generating  some maps using Geoserver and Openlayers which contain
WMS

> layers. I can not define in advance what should be the current extent
> because these WMS layers are generated from geoserver using cql_filter to
> select some specific polygons from my shapefile.
> The goal would be to know automatically the extent of the WMS in order to
> zoom on it.
>
> This is my current map: http://www.nabble.com/file/p13725061/OL1.jpg  and
> this is what i would like to get automatically:
> http://www.nabble.com/file/p13725061/OL2.jpg .
>
> Is there a way to obtain by coding the current extent of the WMS (At
> geoserver or openlayers levels...)??
> I saw by using WFS service, we can get the gml:ccordinates
>
(.../wfs?request=GetFeature&amp;typename=fifao:Fao_areas&amp;cql_filter=F_AREA=27),
> can we extract this information and use it to define the extent of the
map??
>
> Thanks for helping me, i start becoming crazy about that point.
>
> Sylvain
> --
> View this message in context:
http://www.nabble.com/How-can-i-get-the-extent-of-the-WMS-%28JS%2C-WFS%29-tf4797527.html#a13725061
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/dev
>
>



_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: How can i get the extent of the WMS (JS, WFS)

springrider
Thanks for your reply

I have installed GeoJSOn on my Geoserver. The idea would be effectively to pick up the bbox value available in the gml:boundedBy\gml:Box\gml:coordinates tag from the XML obtained with the WFS request using the same filter.

 I tried using the outputformat=JSON (geoserver/wfs?request=GetFeature&typename=fifao:Fao_areas&cql_filter=F_AREA=27&&outputformat=json) but i don't know what should be my syntax at openlayers JS code in order to use this extent to zoom to.
Would you have any example?

Thanks for your help

Does it mean that this kind of infos (WMS extent) can only be obtained by WFS, there is no other way?

Best regards

Sylvain


Bart van den Eijnden (OSGIS)-2 wrote
The way to do this unfortunately is to also perform a WFS request with the
same filter. You can use GeoJSON as the output format. Then you can use the
bbox attribute of the GeoJSON featurecollection (note: this is very new in
Geoserver and has only been added yesterday) as the extent to zoom to.

Btw, it would be a nice enhancement if you could ask Geoserver only for the
bbox of the featurecollection, since you are not interested in the actual
features itself.

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: springrider <springrider@hotmail.com>
Naar: dev@openlayers.org <dev@openlayers.org>
Onderwerp: [OpenLayers-Dev]  How can i get the extent of the WMS (JS, WFS)
Datum: 14/11/07 06:54

>
> Good morning
>
> I am generating  some maps using Geoserver and Openlayers which contain
WMS
> layers. I can not define in advance what should be the current extent
> because these WMS layers are generated from geoserver using cql_filter to
> select some specific polygons from my shapefile.
> The goal would be to know automatically the extent of the WMS in order to
> zoom on it.
>
> This is my current map: http://www.nabble.com/file/p13725061/OL1.jpg  and
> this is what i would like to get automatically:
> http://www.nabble.com/file/p13725061/OL2.jpg .
>
> Is there a way to obtain by coding the current extent of the WMS (At
> geoserver or openlayers levels...)??
> I saw by using WFS service, we can get the gml:ccordinates
>
(.../wfs?request=GetFeature&typename=fifao:Fao_areas&cql_filter=F_AREA=27),
> can we extract this information and use it to define the extent of the
map??
>
> Thanks for helping me, i start becoming crazy about that point.
>
> Sylvain
> --
> View this message in context:
http://www.nabble.com/How-can-i-get-the-extent-of-the-WMS-%28JS%2C-WFS%29-tf4797527.html#a13725061
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Dev mailing list
> Dev@openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
>



_______________________________________________
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev