[OpenLayers-Users] Re : Problem with WFS layer

Nicolas Caussin lacausse at yahoo.com
Wed Mar 25 08:24:31 EDT 2009


Hi Jan,

I already try :


var wfs = new OpenLayers.Layer.WFS(
"ArabianGulf",
"http://localhost:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/wfs/ArabianGulf.map&",
{
typename : "ArabianGulf",
projection: new OpenLayers.Projection("EPSG:900913")
}
);
But there is no difference.

Nicolas.



----- Message initial ----
De : Jan H. van der Ven <jhvdven at xs4all.nl>
À : users at openlayers.org
Cc : NicolasC <lacausse at yahoo.com>
Envoyé le : mercredi 25 mars 2009, 13 h 08 min 36 s
Objet : Re: [OpenLayers-Users]  Problem with WFS layer

Hi,

You need to tell OpenLayers again what projection your WFS is in.
So add a projection parameter to your wfs layers

Kind regards,

Jan




NicolasC schreef:
> 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.
>  
> ------------------------------------------------------------------------
>
>
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com 
> Versie: 8.0.238 / Virusdatabase: 270.11.27/2021 - datum van uitgifte: 03/24/09 16:00:00
>
>  


      Découvrez les styles qui font sensation sur Yahoo! Québec Avatars.
http://cf.avatars.yahoo.com/



More information about the Users mailing list