[OpenLayers-Users] Working with Openlayers.Layer.Vector and WFS

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Fri Jul 16 09:56:05 EDT 2010


Without seeing your actual WFS it is hard to help.

But here it goes:

1) featureType should be MonkeyIsland
2) check if your featureNS does not end with / in the XML returned by your
WFS, this would also break the parser. So maybe
http://www.mapinfo.com/wfs/ instead of http://www.mapinfo.com/wfs

Best regards,
Bart

>
> Hello
>
> I'm having a real hard time changing my OpenLayers.Layer.WFS request to
> the
> OpenLayers.Layer.Vector with OpenLayers.Protocol.WFS. I've been reading
> and
> experimenting all available examples that I was able to find and the API
> documentation (wich, by the way, didn't help very much) for 2 days now and
> couldn't get it to work.
>
> So, please, can someone tell why this old fashion request has a
> successfull
> response:
>
> var wfs = new OpenLayers.Layer.WFS("Guybrush Threepwood",
>
> "http://localhost:2006/GetFeature.ashx",
>                                             { typename:
> "miwfs:MonkeyIsland"
>                                             }, { 'projection': new
> OpenLayers.Projection("EPSG:4326")
>                                              , 'displayProjection': new
> OpenLayers.Projection("EPSG:4326")
>                                              , 'maxExtent': new
> OpenLayers.Bounds(-9.517034, 36.961718, -6.189968, 42.15434)
>                                              , 'maxResolution':
> 156543.0339
>                                              , 'numZoomLevels': 21
>                                              , 'minZoomLevel': 1
>                                              , 'maxZoomLevel': 21
>                                              , 'units': "dd"
>                                              , 'encodeBBOX': true
>                                              , 'displayOutsideMaxExtent':
> true
>                                              , 'styleMap': layerStyle
>                                              , 'extractAttributes': true
>                                             }
>                                             );
>
> map.addLayer(wfs);
>
> But this one, that I found somewhere in the examples or forums, doesn't:
>
> var layer = new OpenLayers.Layer.Vector("Guybrush Threepwood", {
>                 strategies: [new OpenLayers.Strategy.BBOX()],
>                 protocol: new OpenLayers.Protocol.WFS({
>                     version: "1.1.0",
>                     url: "http://localhost:2006/GetFeature.ashx",
>                     featureType: "miwfs:MonkeyIsland",
>                     featureNS: "http://www.mapinfo.com/wfs",
>                     geometryName: "VL_GMTR",
>                     srsName: "EPSG:4326"
>                 }),
>                 projection: new OpenLayers.Projection("EPSG:4326")
>             });
>
> map.addLayer(wfs);
>
> If helps, my map object is:
>
> var map = new OpenLayers.Map("map", {
>         projection: new OpenLayers.Projection("EPSG:900913"),
>         units: "m",
>         maxResolution: 156543.0339,
>         maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
> 20037508.34, 20037508.34),
>         numZoomLevels: 21
>     });
>
> and my baseMap is:
>
> var myBaseLayer = new OpenLayers.Layer.Google("Google",
>               { 'sphericalMercator': true
>               , 'numZoomLevels': 21
>               , 'minZoomLevel': 1
>               , 'maxZoomLevel': 21
>               });
>
>     map.addLayer(myBaseLayer);
>
> Sorry for the long post.
>
> Edu
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Working-with-Openlayers-Layer-Vector-and-WFS-tp5301971p5301971.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
>


-- 
Looking for flexible support on OpenLayers or GeoExt? Please check out
http://www.osgis.nl/support.html

Bart van den Eijnden
OSGIS
bartvde at osgis.nl




More information about the Users mailing list