[OpenLayers-Users] Problem with WFS layer

NicolasC lacausse at yahoo.com
Wed Mar 25 07:16:12 EDT 2009


Hi,

I'm newbie in GIS and Openlayer.

I try to display a shapefile (EPSG:3439), which is the border of persic gulf, on a google map layer.

I write a mapfile for Mapserver which works with QGIS but with Openlayers the WFS layer is displayed in North Africa.


My code :

      var map;

        function init(){
        
            var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("epsg:4326"),
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                                 20037508, 20037508.34)
            };

        
            map = new OpenLayers.Map('map',options);

            var gmap = new OpenLayers.Layer.Google(
                "Google Streets",
                {'sphericalMercator': true}
            );
            map.addLayer(gmap);
            
            var wfs = new OpenLayers.Layer.WFS(
                "ArabianGulf",
                "http://localhost:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/wfs/ArabianGulf.map&",
                {typename : "ArabianGulf"}
            );
            map.addLayer(wfs);

            map.setCenter(new OpenLayers.LonLat(0, 0), 2);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition());
        }

My Mapfile code :

MAP
  EXTENT 258846.354000 2651583.260000 1105456.098000 3113342.963000
  IMAGECOLOR 255 255 255
  IMAGETYPE gif
  SIZE 512 512
  STATUS ON
  UNITS METERS
  CONFIG PROJ_LIB "C:\ms4w\Apache\cgi-bin\proj_lib"
  NAME "adma"

  PROJECTION
    "init=epsg:3439"
  END
    
  
  WEB
    IMAGEPATH ""
    METADATA
      "wfs_srs"    "epsg:3439 EPSG:4326 EPSG:900913"
      "wfs_title"    "adma"
      "wfs_onlineresource"    "http://localhost:8080/cgi-bin/mapserv.exe?"
    "wfs_version" "1.1.0"
    END
    QUERYFORMAT text/html
    LEGENDFORMAT text/html
    BROWSEFORMAT text/html
  END

   LAYER
    DATA ArabianGulf.shp
    DUMP TRUE
    DEBUG 4
    METADATA
      "wfs_extent"    "258846.354000 2651583.260000 1105456.098000 3113342.963000"
      "wfs_onlineressource"    "http://localhost:8080/cgi-bin/mapserv.exe?"
      "gml_geometries_type"    "polygon"
      "wfs_title"    "Arabian Gulf"
      "gml_include_items"    "all"
      "gml_geometries"    "Geometries"
    END
    NAME ArabianGulf
    OFFSITE 0 0 0
    PROJECTION
      "init=epsg:3439"
    END
    STATUS ON
    TYPE POLYGON
    UNITS METERS
  END

  END

If you have any suggestions ???

Regards,

Nicolas.
-- 
View this message in context: http://n2.nabble.com/Problem-with-WFS-layer-tp2531815p2531815.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list