[OpenLayers-Users] How to use OpenLayers requesting WFS with Spatial Operations

Myeong Hun Jeong mhjeong74 at gmail.com
Sat Apr 25 02:03:24 EDT 2009


Hi Roald,
There are two things I want to know.
1. How to send WFS requests to server with openlayers? I know the way to
load WFS layers when I initialize map, but after loading layers, I don't
know how to request WFS with Spatial Operations in OpenLayers.

2. I also want to know the way to display a WFS layer on my map that
automatically requests the correct features within the BBOX of the viewport?

Thanks in advance.

Best Regrards,
Myeonghun Jeong.



2009/4/25 Roald de Wit <roald.dewit at lisasoft.com>

> Hi Myeonghun Jeong,
>
> Can you explain what you try to do? Do you want to display a WFS layer on
> your map that automatically requests the correct features within the BBOX of
> the viewport or do you want to have control over what BBOX you send to the
> WFS server and send your WFS 'manually'?
>
> Maybe it is good to have a look at some examples (type WFS in the search
> box): [1].
>
> Regards, Roald
>
> [1] http://www.openlayers.org/dev/examples/
>
> Myeong Hun Jeong wrote:
>
>>
>> Dear list.
>>
>> I want to know how to use openlayers when I request WFS with Spatial
>> Operations.
>>
>> For example, at GeoServer Demo Request page, I can fin
>> WFS_getFeatureBBox01.1.url and WFS_getFeatureBBox01.1.xml samples.
>>
>> So, the request is that
>>
>>
>> http://localhost:8888/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:states&propertyName=STATE_NAME,PERSONS&BBOX=-75.102613,40.212597,-72.361859,41.512517<
>> http://localhost:8888/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:states&propertyName=STATE_NAME,PERSONS&BBOX=-75.102613,40.212597,-72.361859,41.512517>
>>
>>
>>
>> or
>>
>> http://localhost:8888/geoserver/wfs
>>
>> <wfs:GetFeature service="WFS" version="1.1.0"
>>
>>  xmlns:topp="http://www.openplans.org/topp"
>>
>>  xmlns:wfs="http://www.opengis.net/wfs"
>>
>>  xmlns:ogc="http://www.opengis.net/ogc"
>>
>>  xmlns:gml="http://www.opengis.net/gml"
>>
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
>>  xsi:schemaLocation="http://www.opengis.net/wfs
>>
>>                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
>>
>>  <wfs:Query typeName="topp:states">
>>
>>    <wfs:PropertyName>topp:STATE_NAME</wfs:PropertyName>
>>
>>    <wfs:PropertyName>topp:PERSONS</wfs:PropertyName>
>>
>>    <ogc:Filter>
>>
>>      <ogc:BBOX>
>>
>>        <ogc:PropertyName>the_geom</ogc:PropertyName>
>>
>>        <gml:Envelope srsName="
>> http://www.opengis.net/gml/srs/epsg.xml#4326">
>>
>>           <gml:lowerCorner>-75.102613 40.212597</gml:lowerCorner>
>>
>>           <gml:upperCorner>-72.361859 41.512517</gml:upperCorner>
>>
>>        </gml:Envelope>
>>
>>      </ogc:BBOX>
>>
>>   </ogc:Filter>
>>
>>  </wfs:Query>
>>
>> </wfs:GetFeature>
>>
>>
>> But when I use openlayers, how to request thses requests exactly?
>>
>> For instance, when I request GetFeatureInfo with openlayers.
>>
>> // support GetFeatureInfo
>>
>>            map.events.register('click', map, function (e) {
>>
>>                document.getElementById('nodelist').innerHTML = "Loading...
>> please wait...";
>>
>>                var url =  map.layers[0].getFullRequestString(
>>
>>                    {
>>
>>                        REQUEST: "GetFeatureInfo",
>>
>>                        EXCEPTIONS: "application/vnd.ogc.se_xml",
>>
>>                        BBOX: map.getExtent().toBBOX(),
>>
>>                        X: e.xy.x,
>>
>>                        Y: e.xy.y,
>>
>>                        INFO_FORMAT: 'text/html',
>>
>>                        QUERY_LAYERS: map.layers[0].params.LAYERS,
>>
>>                        FEATURE_COUNT: 50,
>>
>>                        WIDTH: map.size.w,
>>
>>                        HEIGHT: map.size.h
>>
>>                    },
>>
>>                    "http://localhost:8888/geoserver/wms"
>>
>>                );
>>
>>                OpenLayers.loadURL(url, '', this, setHTML, setHTML);
>>
>>                OpenLayers.Event.stop(e);
>>
>>            });
>>
>>        }
>>
>>
>>
>> Please, give me a piece of information.
>>
>>
>> Best regards,
>>
>> Myeonghun Jeong.
>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090425/c517a35f/attachment.html


More information about the Users mailing list