[OpenLayers-Users] How to display WFS layer from MapServer?

Luís de Sousa luis.a.de.sousa at gmail.com
Thu May 16 08:10:11 PDT 2013


Dear all, 

I have MapServer serving a simple polygon layer defined in this way: 

  LAYER 
    NAME "buildings_gml"
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "/var/sampleData/BuildingsFull.gml"
    STATUS ON
    DUMP TRUE 

    PROJECTION
      "init=epsg:28992"
    END
    
    METADATA
      "ows_title" "Building footprints"
      "ows_abstract" "Data set of building footprints"
      "gml_include_items" "all"  
      "ows_featureid" "cat" 
    END

    CLASS
     NAME "building_footprints"
     OUTLINECOLOR 255 0 0
    END    
  END

I can access this layer with QGis using both the WFS and WMS protocols. I'd
like to display it as a WFS layer in an OL map; I'm using this set up:

	buildsWFS = new OpenLayers.Layer.Vector("BuildingsWFS", {
        strategies: [new OpenLayers.Strategy.Fixed()],
        projection: new OpenLayers.Projection("EPSG:28992"),
        protocol: new OpenLayers.Protocol.WFS({
            url:
"http://myServer/cgi-bin/mapserv?map=/var/www/MapFiles/test.map",
            featureType: "buildings_gml",
            featureNS: "http://mapserver.gis.umn.edu/mapserver"
            srsName: "EPSG:28992",
        })
    });

When I add this layer to the map object I don't get any JS errors back but
no requests are issued to the server and hence nothing shows up in the map.

Using a WMS layer object I can display this layer without issue, using this
set up:

	buildsWMS =  new OpenLayers.Layer.WMS(
    	"BuildingsWMS",
    	"http://myServer/cgi-bin/mapserv?map=/var/www/MapFiles/test.map",
        {layers: "buildings_gml", 
         format: "image/png",
         srsName: "EPSG:28992",
	 	 transparent: "true",
     	 projection: new OpenLayers.Projection("EPSG:28992")},
        {isBaseLayer: false,  
     	 visibility: true}
    );

I understand that displaying WFS layers from MapServer poses regular
difficulties, but even after going through several threads [1,2,3,4] with
similar problems I still can't find what is wrong in my case.

Any help appreciated, Thank you,

Luís

[1]
http://lists.osgeo.org/pipermail/openlayers-users/2011-May/thread.html#20574

[2]
http://gis.stackexchange.com/questions/57545/why-is-mapserver-layer-not-showing-up-in-openlayers

[3]
http://stackoverflow.com/questions/14477019/wfs-mapserver-layer-not-showing-up-in-openlayers

[4]
http://gis.stackexchange.com/questions/26627/set-up-wfs-service-on-mapserver-and-display-in-openlayers 



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-display-WFS-layer-from-MapServer-tp5053728.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list