#1 Tue 23 March 2010 14:05
- APierre
- Participant occasionnel
- Date d'inscription: 23 Mar 2010
- Messages: 14
Problèmes projections openlayers/Mapserver
Bonjour,
Je suis étudiant et assez débutant dans le domaine du webmapping.
Dans le cadre d'un projet pour les études j'essaye de faire un guichet cartographique pour une commune.
Il s'agit d'afficher un fond de plan (choix orthophoto ou google maps) et par dessus d'afficher des données vectorielles type conduites, plan de zones...
Mon problème actuellement est l'affichage des orthophotos : j'utilise Mapserver voici le code du .map :
Code:
MAP NAME "Vallorbe" STATUS ON SIZE 200 200 EXTENT 513500 170000 523600 177000 UNITS METERS SHAPEPATH "Swissimage04/" IMAGETYPE PNG PROJECTION "init=epsg:21781" END WEB IMAGEPATH "C:/ms4w/tmp/ms_tmp/" IMAGEURL "/ms_tmp/" LOG "C:/ms4w/tmp/log/" METADATA "wms_title" "WMS Test" "wms_onlineresource" "http://apache/cgi-bin/mapserv.exe?map=D:/projets/2010/geo/meyer/TS_2010/Vallorbe.map&" "wms_srs" "epsg:21781" "wms_format" "image/png" "wfs_title" "WFS Test" "wfs_onlineresource" "http://apache/cgi-bin/mapserv.exe?map=D:/projets/2010/geo/meyer/TS_2010/Vallorbe.map&" "wfs_srs" "epsg:21781" END END #############ORHTOS######################### LAYER NAME "1201_42" TYPE RASTER STATUS ON DATA "1201_42.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_44" TYPE RASTER STATUS ON DATA "1201_44.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_13" TYPE RASTER STATUS ON DATA "1201_13.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_14" TYPE RASTER STATUS ON DATA "1201_14.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_31" TYPE RASTER STATUS ON DATA "1201_31.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_32" TYPE RASTER STATUS ON DATA "1201_32.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_33" TYPE RASTER STATUS ON DATA "1201_33.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END LAYER NAME "1201_34" TYPE RASTER STATUS ON DATA "1201_34.jpg" PROJECTION "init=epsg:21781" END METADATA "wms_title" "Ortho" END END #############FIN ORHTOS######################### LAYER NAME "Parcelles" TYPE POLYGON STATUS ON DATA "Bie_Bien_fonds_ili.shp" CLASS NAME "Parcelles" STYLE OUTLINECOLOR 0 0 0 END END #CLASS PROJECTION "init=epsg:21781" END METADATA "wms_title" "Parcelles" "gml_featureid" "Nom" "gml_include_items" "all" END DUMP TRUE END #LAYER END
Code javascript, openlayers
Code:
</style> <script src="http://openlayers.org/api/OpenLayers.js"></script> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAMnUP2OscziB71LfPQBVDTBS36fy1C67uFvqw6k5574VKBBkJhxRBUPP4gx_hzn2xUl_73xpvKBjOcw"></script> <script src="libraries/proj4js-EPSG21781.js"></script> <script src="libraries/proj4js-combined.js"></script> <script type="text/javascript"> var map; var layerList = new Array(); var layerButton = new Array(); var longitude; var latitude; function init() { // Options de la carte var options = { projection: new OpenLayers.Projection("EPSG:21781"), maxExtent: new OpenLayers.Bounds(513500, 170000, 523600, 177000), maxResolution: "auto", controls: [ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.MousePosition() ], numZoomLevels: 10, minZoomLevel: 10, maxZoomLevel: 20 }; map = new OpenLayers.Map("map", options); //déclaration des couches var g_hybrid= new OpenLayers.Layer.Google( "Google Hybrid", {type: G_HYBRID_MAP} ); var g_streets = new OpenLayers.Layer.Google( "Google Streets" ); var g_physical = new OpenLayers.Layer.Google( "Google Physical", {type: G_PHYSICAL_MAP} ); var g_satellite = new OpenLayers.Layer.Google( "Google Satellite", {type: G_SATELLITE_MAP} ); //Création de la couche Ortho var wms_ortho = new OpenLayers.Layer.WMS( "Orthophoto 2007", "http://apache/cgi-bin/mapserv.exe?map=D:/projets/2010/geo/meyer/TS_2010/Vallorbe.map&", { Layers: ['1201_42', '1201_44', '1201_13', '1201_14', '1201_31', '1201_32', '1201_33', '1201_34'], format: "image/png", srs: 'EPSG:21781' } ); //Création des couches SIT var Parcelles = new OpenLayers.Layer.WMS( "Parcelles", "http://apache/cgi-bin/mapserv.exe?map=D:/projets/2010/geo/meyer/TS_2010/Vallorbe.map&", { Layers: "Parcelles", format: "image/png", srs: 'EPSG:21781', } ); // Tableau avec la liste des couches layerList["GStreets"] = g_streets; layerList["GHybrid"] = g_hybrid; layerList["GSatellite"] = g_satellite; layerList["Ortho"] = wms_ortho; layerList["Parcelles"] = Parcelles; // Tableau avec la liste des boutons d'options layerButton["GStreets"] = "GStreets"; layerButton["GHybrid"] = "GHybrid"; layerButton["GSatellite"] = "GSatellite"; layerButton["Ortho"] = "Ortho"; layerButton["Parcelles"] = "Parcelles"; map.addLayers([ //g_hybrid, //g_streets, //g_physical, //g_satellite, wms_ortho, Parcelles ]); //map.setCenter(new OpenLayers.LonLat(6.376463, 46.711525), 4); map.setCenter(new OpenLayers.LonLat(518000, 174000), 5); document.getElementById('Ortho').checked = true; } // fin init() function update() { var layer; var button; for (i in layerList){ layer = layerList[i]; button = layerButton[i]; layer.setVisibility(document.getElementById(button).checked); if (document.getElementById(button).checked) {map.setBaseLayer(layer)}; } } </script>
Les orthophotos apparaissent en partie, et c'est lent.
Pour l'instant j'utilise seulement les orthos en fond :
Ii y a une interférence entre le système google maps puis celui de mes données.
Quel code utiliser pour améliorer cela?
Quel code pour afficher correctement les données vectorielles (wfs..) ?
Merci d'avance
Dernière modification par APierre (Tue 23 March 2010 16:43)
Hors ligne