#1 Mon 29 June 2009 16:44
- nicolas.leclerc
- Participant actif
- Date d'inscription: 8 Apr 2009
- Messages: 78
[Openlayers] Couche wfs
Bonjour à tous,
J'essaie depuis plusieurs jours d'afficher une couche wfs sous openlayers. Le problème qui se pose est le suivant : j'affiche déjà une couche wfs et wms je ne comprends pas pourquoi cette couche refuse de s'afficher.
mon second problème est un problème d'échelle en effet, mon échelle n'apparaît pas et mon overview est complètement disproportionné.
Firebug ne m'indique aucune erreur.
je vous donne mon mapfile et mon code html
Merci d'avance
Code:
NAME "WMS" STATUS ON SIZE 300 300 SYMBOLSET ./symbols/symbols.sym EXTENT 432763 190669 464957 217339 UNITS METERS SHAPEPATH "C:\ms4w\Apache\htdocs\geoportail_aurh_commerce\data\lz1_ge_lehavre" IMAGECOLOR 255 255 255 FONTSET ./fonts/fonts.list WEB IMAGEPATH "C:\ms4w\Apache\htdocs\geoportail_aurh_commerce\temp\" IMAGEURL "/geoportail_aurh_commerce/temp/" METADATA "wms_title" "WMS" ##required "wms_onlineresource" "http://192.168.25.22/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/geoportail_aurh_commerce/geoportail_aurh_commerce.map" ##required "wms_srs" "EPSG:27561" ##recommended "wfs_title" "WFS" ## REQUIRED "wfs_onlineresource" "http://192.168.25.22/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/geoportail_aurh_commerce/geoportail_aurh_commerce.map" ## Recommended "wfs_srs" "EPSG:27561" ## Recommended END END PROJECTION "init=epsg:27561" ##required END # # Start of layer definitions # LAYER NAME "rasterlh" METADATA "wms_title" "rasterlh" ##required END TYPE RASTER STATUS ON DATA "c_lh_ext_ign_scan25_2008.tif" PROJECTION "init=epsg:27561" ##recommended END CLASS NAME "c_lh_ext_ign_scan25_2008" STYLE COLOR 200 255 0 OUTLINECOLOR 120 120 120 END END END # Layer LAYER NAME "troncon" METADATA "wfs_title" "troncon" ## REQUIRED "gml_featureid" "NAME" ## REQUIRED "gml_include_items" "all" ## Optional (serves all attributes for layer) END TYPE LINE STATUS ON DATA "t_sig_rgvdh_voie_troncon" PROJECTION "init=epsg:27561" END DUMP TRUE ## REQUIRED CLASS NAME "troncon" STYLE COLOR 255 0 0 END TEMPLATE "C:\ms4w\Apache\htdocs\geoportail_aurh_commerce.html" END END # Layer LAYER NAME "Fond_communal" METADATA "wfs_title" "Fond_communal" ## REQUIRED "gml_featureid" "NAME" ## REQUIRED "gml_include_items" "all" ## Optional (serves all attributes for layer) END TYPE POLYGON STATUS ON DATA "ext_ign_bdtop_2008_commune" PROJECTION "init=epsg:27561" END DUMP TRUE ## REQUIRED CLASS NAME "Fond_communal" STYLE COLOR 255 0 0 END TEMPLATE "C:\ms4w\Apache\htdocs\geoportail_aurh_commerce.html" END END # Layer END # Map File
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <title>Cartographie - Section commerce</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="shortcut icon" href="favicon.gif" /> <link rel="stylesheet" media="screen" type="text/css" title="Design" href="../css/geoportail_aurh_commerce.css" /> <script src="../scripts/openlayers/lib/OpenLayers.js"></script> <script type="text/javascript"> function init(){ map = new OpenLayers.Map( 'map', { projection : new OpenLayers.Projection("EPSG:27561"), maxExtent: new OpenLayers.Bounds(432763, 190669, 464957, 217339), units:'meters', maxResolution: 'auto', controls: [ new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.MouseToolbar(), new OpenLayers.Control.OverviewMap(), new OpenLayers.Control.ScaleLine(), new OpenLayers.Control.KeyboardDefaults(), new OpenLayers.Control.LayerSwitcher() ]}); var bounds = new OpenLayers.Bounds( 432763, 190669, 464957, 217339 ); var wms = new OpenLayers.Layer.WMS( "Fond CODAH raster", "http://192.168.25.22/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/geoportail_aurh_commerce/geoportail_aurh_commerce.map", {layers: "rasterlh"},{projection:"EPSG:27561",singleTile: true, opacity: 1, isBaseLayer : true} ); var wfs = new OpenLayers.Layer.WFS( "Troncon", "http://192.168.25.22/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/geoportail_aurh_commerce/geoportail_aurh_commerce.map", {typename: "topp:troncon"} ); var wfs1 = new OpenLayers.Layer.WFS( "Fond communal", "http://192.168.25.22/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/geoportail_aurh_commerce/geoportail_aurh_commerce.map", {typename: "topp:Fond_communal"} ); map.addLayers([wms, wfs, wfs1]); map.zoomToExtent(bounds); } </script> </head> <body onload="init()"> <div id="conteneur"> <div id="map" class="smallmap" style="width:970px; height: 670px"></div> <div id="retour"><a href="http://192.168.25.22/geoportail_aurh_homepage.php" ><img src="../images/bouton_retour.png" alt="Page d'accueil" title="Retour à la page d'accueil"></a></div> <div id="modif"><a href='http://192.168.25.22/geoportail_aurh_commerce_modifier_une_couche.php' ><img src='../images/modif.png' alt="accès à la modification d'une couche" title="accéder à la modification d'une couche" /></a></div> </div> </body> </html>
Hors ligne