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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<script type="text/javascript" src="http://api.ign.fr/geoportail/api?v-e=1.0beta4&key=00000000000000000000000&instance=map"> <!-- -->
</script>
<script type="text/javascript">
initGeoportalMap = function() {
var coeur = new OpenLayers.Layer.WMS(
"Coeur du PN Ecrins"
,"http://cartotest.ecrins-parcnational.fr/wms?"
,{layers: "coeur", format: "image/png",transparent:"TRUE" }
,{projection: "EPSG:4326", isBaseLayer: false}
);
return{
init: function () {
geoportalLoadmap("GeoportalmapDiv", "normal","FXX");
// Exemple avec un code territoire (ici la Guadeloupe)
//geoportalLoadmap("GeoportalmapDiv", "normal", "GLP");
if (map) {
map.addGeoportalLayers();
map.getMap().setCenterAtLonLat("6d20'E", "44d53N",8);
map.openToolsPanel(false);
map.openLayersPanel(false);
map.getMap().addLayer(coeur);
}
}
,localiserGPS: function (x,y){
var position = new OpenLayers.Geometry.Point(x, y);
//var z32 = new OpenLayers.Projection("epsg:32632")
//position.transform(z32, map.projection);
position.transform(OpenLayers.Projection.CRS84, map.projection);
var marqueurGeoportail = new OpenLayers.Feature.Vector(
position
,null
);
// couche du marqueur
var couche = new OpenLayers.Layer.Vector('Marqueur');
couche.addFeatures([marqueurGeoportail]);
map.getMap().addLayer(couche);
}
}
}();
</script>
</head>
<body onload="initGeoportalMap.init();">
<div style="color:#a2a2a2;font-size:2em;">Petit test pour le parc national des Ecrins</div>
<form name="floc">
GPS x : <input type="text" name="fx" size="30" value="">
GPS y : <input type="text" name="fy" size="30" value="">
<img src = "images/tick.gif" alt="Localiser" title="localiser" border="0" width="25px" align="absmiddle" onclick="return initGeoportalMap.localiserGPS(document.floc.fx.value, document.floc.fy.value)">
</form>
<div id="GeoportalmapDiv" style="width:800px;height:600px;"></div>
</body> |
Partager