[OpenLayers-Users] Problem with a WFS request

bartvde at osgis.nl bartvde at osgis.nl
Fri Aug 21 09:54:08 EDT 2009


Your GML looks okay to me. You don't have any attributes (next to the
geometry), but that should be no problem.

Can you see the request go off with Firebug at all when adding the vector
layer to your map? Are you using a proxy in between or is the traffic
local?

Best regards,
Bart

> Indeed, I see ms:aster_gdem in the XML flow. I added featurePrefix but
> it's still not working.
> Maybe I did some bad things in the map file ? But if it works when I
> make an URL request...
>
> I added an ID attribute to my shapefile objects to indicate the
> gml_featureid in the map file. Here is a sample of the XML flow I obtain
> with an URL request
> (http://IP/cgi-bin/mapserv_5.4.1?map=/var/www/html/WFS_server/test.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=aster_gdem&BBOX=70,35,75,37)
> :
>
> <?xml version='1.0' encoding="ISO-8859-1" ?>
> <wfs:FeatureCollection
>    xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>    xmlns:wfs="http://www.opengis.net/wfs"
>    xmlns:gml="http://www.opengis.net/gml"
>    xmlns:ogc="http://www.opengis.net/ogc"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
>                        http://mapserver.gis.umn.edu/mapserver
> http://IP/cgi-bin/mapserv_5.4.1?map=/var/www/html/WFS_server/test.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=aster_gdem&amp;OUTPUTFORMAT=XMLSCHEMA">
>       <gml:boundedBy>
>           <gml:Box srsName="EPSG:4326">
>               <gml:coordinates>72.999889,34.999868
> 75.000043,37.000021</gml:coordinates>
>           </gml:Box>
>       </gml:boundedBy>
>     <gml:featureMember>
>       <ms:aster_gdem fid="aster_gdem.597">
>
>         <gml:boundedBy>
>             <gml:Box srsName="EPSG:4326">
>                 <gml:coordinates>72.999889,34.999868
> 74.000115,36.000094</gml:coordinates>
>             </gml:Box>
>         </gml:boundedBy>
>         <ms:msGeometry>
>         <gml:Polygon srsName="EPSG:4326">
>           <gml:outerBoundaryIs>
>
>             <gml:LinearRing>
>               <gml:coordinates>72.999889,36.000094 74.000115,36.000094
> 74.000115,34.999868 72.999889,34.999868 72.999889,36.000094
> </gml:coordinates>
>             </gml:LinearRing>
>           </gml:outerBoundaryIs>
>         </gml:Polygon>
>         </ms:msGeometry>
>       </ms:aster_gdem>
>     </gml:featureMember>
>
>     <gml:featureMember>
>       <ms:aster_gdem fid="aster_gdem.336">
>         <gml:boundedBy>
>             <gml:Box srsName="EPSG:4326">
>                 <gml:coordinates>74.000115,36.000094
> 75.000043,37.000021</gml:coordinates>
>             </gml:Box>
>         </gml:boundedBy>
>         <ms:msGeometry>
>
>         <gml:Polygon srsName="EPSG:4326">
>           <gml:outerBoundaryIs>
>             <gml:LinearRing>
>               <gml:coordinates>74.000115,37.000021 75.000043,37.000021
> 75.000043,36.000094 74.000115,36.000094 74.000115,37.000021
> </gml:coordinates>
>             </gml:LinearRing>
>           </gml:outerBoundaryIs>
>         </gml:Polygon>
>         </ms:msGeometry>
>
>       </ms:aster_gdem>
>     </gml:featureMember>
> </wfs:FeatureCollection>
>
> Thanks again for your help,
>
> Best regards,
>
> Arthur
>
> bartvde at osgis.nl a écrit :
>> Hi,
>>
>> is there any prefix used in your GML, again Mapserver defaults to ms:,
>> so
>> in that case you need to add:
>>
>> featureType: "aster_gdem",
>> featureNS: "http://mapserver.gis.umn.edu/mapserver",
>> featurePrefix: "ms"
>>
>> Best regards,
>> Bart
>>
>>> Thank you !
>>>
>>> Now I think I am close but it's still not working... Vectors are not
>>> displayed. Do you see where I am wrong ?
>>>
>>> var map, wms, test_WFS;
>>> function init()
>>> {
>>>     map = new OpenLayers.Map('map', {
>>>         controls: [new OpenLayers.Control.Navigation(),
>>>             new OpenLayers.Control.PanZoom(),
>>>             new OpenLayers.Control.LayerSwitcher()
>>>         ]
>>>     });
>>>
>>>     wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
>>>         "http://labs.metacarta.com/wms/vmap0", {
>>>             layers:'basic'
>>>         }
>>>     );
>>>
>>>     test_WFS = new OpenLayers.Layer.Vector("test WFS", {
>>>         strategies: [new OpenLayers.Strategy.BBOX()],
>>>         protocol: new OpenLayers.Protocol.WFS({
>>>             url:
>>> "http://IP-address/cgi-bin/mapserv_5.4.1?map=/var/www/html/WFS_server/test.map",
>>>             featureType: "aster_gdem",
>>>             featureNS: "http://mapserver.gis.umn.edu/mapserver"
>>>         })
>>>     });
>>>
>>>     map.addLayers([wms, test_WFS]);
>>>
>>>     map.zoomToMaxExtent();
>>> }
>>>
>>> Best regards,
>>>
>>> Arthur
>>>
>>> bartvde at osgis.nl a écrit :
>>>> Hi Arthur,
>>>>
>>>> yes the BBOX strategy will take care of that.
>>>>
>>>> The GML version is determined by the protocol version, WFS 1.0 is tied
>>>> to
>>>> GML2, whereas WFS 1.1 is tied to GML3. The WFS protocol version
>>>> defaults
>>>> to 1.0, so you will get the Format.GML.v2 parser. So you should not
>>>> need
>>>> to change anything.
>>>>
>>>> You can retrieve the url for featureNS from a WFS DescribeFeatureType
>>>> request (intranet url, for example only):
>>>>
>>>> http://test.intranet.rijkswaterstaat.nl/services/geoservices/overzichtskaartnl?service=WFS&request=DescribeFeatureType&version=1.0.0
>>>>
>>>> then check the source and look for targetNamespace, by default this is
>>>> http://mapserver.gis.umn.edu/mapserver
>>>>
>>>> Best regards,
>>>> Bart
>>>>
>>
>>
>>
>





More information about the Users mailing list