Bonjour.
J'utilisais avec Geoportal.load avec
Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 {language:'fr', layers:['GEOGRAPHICALGRIDSYSTEMS.MAPS','ORTHOIMAGERY.ORTHOPHOTOS'], layersOptions:{'GEOGRAPHICALGRIDSYSTEMS.MAPS':{visibility:true,opacity:1,name:'Nos randonées'},'ORTHOIMAGERY.ORTHOPHOTOS':{ visibility:false,opacity: 0.4,name:'Photo aérienne'}}, overlays:{}, onView:initcarteRandoSavoie }
Cela permettait d'appeler la fonction initcarte dont le début du code se trouve en fin de ma question ;
J'utilise maintenant new ol.Map({....
Comment appeler la fonction inicarte / faut-il s'y prendre autrement pour l'instant je ne trouve pas.
Mon objectif étant d'afficher une image en un point, une trace gpx partant de ce point.
Merci pour votre aide.
Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 function initcarte() { CarteRandoSavoie=RandoSavoie.getViewer(); CarteRandoSavoie.getMap().addControl(new Geoportal.Control.LayerSwitcher()); // préparation passage en projection Geoportail var sourceproj = OpenLayers.Projection.CRS84; // WGS84 var destproj=CarteRandoSavoie.getMap().getProjection();// projection Geoportail //tableau des POI mesdeparts =new Array; // style du POI var stylepoi = {externalGraphic:'../ressources/balade.gif', graphicWidth:30, graphicHeight:60 }; // Création des POIs for(i=0;i<compteur;i++) { var mon_point = new OpenLayers.Geometry.Point(mespoints[i].long,mespoints[i].lat); mon_point.transform(sourceproj, destproj); // Creation du POI a partir du point mesdeparts[i] = new OpenLayers.Feature.Vector(mon_point, null, stylepoi); mesdeparts[i].attributes['dossier']=mespoints[i].dossier; mesdeparts[i].attributes['numero']=mespoints[i].numero; mesdeparts[i].attributes['lonpoi']=mespoints[i].long; mesdeparts[i].attributes['latpoi']=mespoints[i].lat; } // Ajout d'une couche d'objet vectoriels couchePOI = new OpenLayers.Layer.Vector('Départs'); // Ajout du tableau des POIs a la couche couchePOI.addFeatures(mesdeparts); // Ajout de la couche des POIs a la carte CarteRandoSavoie.getMap().addLayer(couchePOI); ....
Partager