[OpenLayers-Users] Re : Problem with WFS layer
Christopher Schmidt
crschmidt at metacarta.com
Wed Mar 25 08:33:45 EDT 2009
On Wed, Mar 25, 2009 at 05:24:31AM -0700, Nicolas Caussin wrote:
>
> 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.
projection is an *option* -- it is the fourth parameter, not the third.
Also, it should be th projection of the source data -- which appaers to
be 4326 in your case, not 900913.
>
> 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/
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list