[OpenLayers-Users] WMS Layer displayed but Not WFS

Mustafa646 noorcs22 at gmail.com
Tue Aug 16 07:18:32 EDT 2011


I have a shapefile with native projection EPSG:3008 published on GeoServer.
On client side in OpenLayer code, WMS layer displayed over Google map but
not WFS. Below is the code for displaying both the layers.

 function init() {

        OpenLayers.ProxyHost = "/dnn_544/proxy.ashx?url=";

        var options = {

            projection: new OpenLayers.Projection("EPSG:3008"),
displayProjection: new OpenLayers.Projection("EPSG:3008"), units: "m",
            unmZoomLevels: 20,
            maxResolution: 156543.0339,
            maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508,
20037508.34)
        };

 map = new OpenLayers.Map('map', options);
        // Create a Google layer
        gmap = new OpenLayers.Layer.Google(
            "Google Streets", // the default
            {'sphericalMercator': true, numZoomLevels: 20 });

var wmslayer = new OpenLayers.Layer.WMS("Testing Projection", GEOSERVER_WMS,
{ 'layers': 'TestSpace:Bilhinder_point', 'format': 'image/png',
'transparent': 'true' }, { 'opacity': 1.0, 'isBaseLayer': false,
'visibility': true });
       
map.addLayers([gmap, wmslayer]);

//////////////////////////////////////////////////// until this code, WMS
layer displayed successfully.

 var prj = new OpenLayers.Projection("EPSG:3008");

 wfs = new OpenLayers.Layer.Vector("Edit Points", {
            projection: prj,
            styleMap: StyleMap,
            eventListeners: {
                "featuresadded": ZoomToData
            },
            strategies: [new OpenLayers.Strategy.Fixed()],

            protocol: new OpenLayers.Protocol.WFS({
                url: GEOSERVER_WFS,
                featureType: "Bilhinder_point",
                featureNS: "http://www.openplans.org/TestSpace",
                geometryName: "the_geom",
                srsName: "EPSG:3008",
                version: "1.1.0",
                extractAttributes: true,
                isBaseLayer: false,
                visibility: true
            })

        });

        map.addLayer(wfs);

/////////////////////////////////////////////////////////// By using above
code, WFS does not display over Google base map.

Can anybody help me what is wrong ? why WMS displayed but not WFS ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMS-Layer-displayed-but-Not-WFS-tp6690932p6690932.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list