/* * Copyright (c) 2008-2012 Institut National de l'information Geographique et forestiere France, released under the * BSD license. */ /** * Property: viewer * {} the viewer global instance. */ viewer= null; /** * Function: initMap * Load the application. Called when all information have been loaded by * (). */ function initMap() { //The api is loaded at this step //L'api est chargée à cette étape //add translations translate(); //options for creating viewer: var options= { // default value // valeur par défaut //mode:'normal', // default value // valeur par défaut //territory:'FXX', // default value // valeur par défaut //displayProjection:'IGNF:RGF93G' // only usefull when loading external resources // utile uniquement pour charger des resources externes */ //proxy:'/geoportail/api/xmlproxy'+'?url=' }; // viewer creation of type // création du visualiseur du type // HTML div id, options viewer= new Geoportal.Viewer.Default('viewerDiv', OpenLayers.Util.extend( options, // API keys configuration variable set by // variable contenant la configuration des clefs API remplie par window.gGEOPORTALRIGHTSMANAGEMENT===undefined? {'apiKey':'k3ahdvqpd6vvizn0pq0mqxr5'} : gGEOPORTALRIGHTSMANAGEMENT) ); if (!viewer) { // problem ... OpenLayers.Console.error(OpenLayers.i18n('new.instance.failed')); return; } // add photos and maps with default settings // ajout des photos et cartes avec leur configuration par défaut viewer.addGeoportalLayers([ 'ORTHOIMAGERY.ORTHOPHOTOS','CADASTRALPARCELS.PARCELS', 'GEOGRAPHICALGRIDSYSTEMS.MAPS','HYDROGRAPHY.HYDROGRAPHY','ADMINISTRATIVEUNITS.BOUNDARIES','BUILDINGS.BUILDINGS'], { }); // set center at default location and zoom // centrage en utilisant la position et la résolution par défaut // viewer.getMap().setCenter(viewer.viewerOptions.defaultCenter,viewer.viewerOptions.defaultZoom); // cache la patience - hide loading image viewer.getMap().addLayer( "WMS", 'carte Geologique', "http://geoservices.brgm.fr/geologie", {//paramètres_du_wms: contient tous les paramètres nécessaires au paramétrage du service WMS layers:'SCAN_F_GEOL250', format:'image/png', transparent:'true' }, { //options_couche: contient les paramètres pour gérer le comportement de la couche WMS projection:'EPSG:4326', visibility:true, legends:[{ minScale:1000000, maxScale:25000, // href: 'URL/vers/ma/legende.jpg', href: 'http://www.geoportail.gouv.fr/depot/fiches/cartegeologiques/cartegeologie.jpg', width:1200, height:900, title: "Légende pour les échelles de 1:1000000 à 1:25000" }] } ); // viewer.getMap().addLayer( 'GPX', 'Pyrenees', '../data/Balaitous.gpx', { params: { // layer's options ... minZoomLevel: 10, maxZoomLevel: 15, originators: [{ pictureUrl: './img/tracegps.gif', url: 'http://www.tracegps.com/' }], } } ); // Fin Ajout GPS ........................................................... viewer.getMap().setCenterAtLonLat(-0.3126, 42.833, 10); viewer.div.style[OpenLayers.String.camelize('background-image')]= 'none'; } /** * Function: loadAPI * Load the configuration related with the API keys. * Called on "onload" event. * Call () function to load the interface. */ function loadAPI() { // wait for all classes to be loaded // on attend que les classes soient chargées if (checkApiLoading('loadAPI();',['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) { return; } // load API keys configuration, then load the interface // on charge la configuration de la clef API, puis on charge l'application Geoportal.GeoRMHandler.getConfig(['k3ahdvqpd6vvizn0pq0mqxr5'], null,null, { onContractsComplete: initMap }); } // assign callback when "onload" event is fired // assignation de la fonction à appeler lors de la levée de l'évènement "onload" window.onload= loadAPI;