#1 Wed 25 March 2009 10:30
- lacausse
- Juste Inscrit !
- Date d'inscription: 25 Mar 2009
- Messages: 6
[Openlayers] Problème Couche WFS avec Google Map
Bonjour,
Je suis novice dans la programmation SIG.
Je suis entrain de devenir fou avec un problème de couche WFS.
J'ai un Shapefile couvrant une parti des côtes du golf persique. (EPSG:3439)
J'ai fait pour Mapserver un .map interrogeant le shapefile. Avec QGIS, ca marche très bien, la couche WFS s'aligne parfaitement avec les côtes.
Mais mon projet doit fonctionner avec OpenLayers.
J'ai donc écrit ce code :
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());
}Voici le 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
ENDEt la mauvaise surprise est que ma couche WFS se retrouve au nord de l'afrique...
Si quelqu'un a une idée, je suis preneur.
Je vous remercie.
Nicolas.
Hors ligne
#2 Wed 25 March 2009 14:43
- René-Luc D'Hont
- Participant assidu
- Date d'inscription: 7 Nov 2006
- Messages: 328
- Site web
Re: [Openlayers] Problème Couche WFS avec Google Map
As tu vérifier avec ton navigateur que tu pouvais récupérer ta couche WFS en 900913, en écrivant une requête WFS getFeature ?
Ensuite si tu utilises Firefox avec l'extension Firebug, tu seras suceptible de vérifier la requête WFS passer au serveur et donc vérifier qu'OpenLayers demande ce qu'il faut.
Hors ligne


