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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| <html>
<head>
<!-- Library OpenLayers 3 -->
<link rel="stylesheet" type="text/css" href="/v4.0.1/css/ol.css">
<script type="text/javascript" src="/v4.0.1/build/ol.js">
</script>
<!-- Extension Géoportail pour OpenLayers 3 -->
<link rel="stylesheet" type="text/css" href="/ol3/GpPluginOl3.css">
<script type="text/javascript" src="/ol3/GpPluginOl3.js">
</script>
<style type="text/css">
#map {
padding: 5px;
width: 100%;
height: 300px;
box-shadow: 0 0 10px #999;
}
#info {
padding: 5px;
width: 100%;
height: 20px;
font-family: "monospace";
font-size: 10px;
}
</style>
</head>
<body>
<script type='text/javascript'>//<![CDATA[
window.onload = function () {
Gp.Services.getConfig({
apiKey: 'CLE_API',
onSuccess: function (response) {
// votre utilisation de l'extension Géoportail pour OpenLayers 3
var osmLyr = new ol.layer.Tile({
source: new ol.source.OSM()
});
var map = new ol.Map({
target: 'map',
layers: [
osmLyr,
new ol.layer.GeoportalWMTS({
layer: "GEOGRAPHICALGRIDSYSTEMS.MAPS",
}),
new ol.layer.GeoportalWMTS({
layer: "ORTHOIMAGERY.ORTHOPHOTOS",
olParams: {
opacity: 0.7
}
})
],
view: new ol.View({
center: [288074.8449901076, 6247982.515792289],
zoom: 12
})
});
var lsControl = new ol.control.LayerSwitcher({
layers : [{
layer: osmLyr,
config: {
title: "OSM",
description: "Couche OpenStreet Map",
}
}],
options : {
collapsed: true
}
});
map.addControl(lsControl);
var infoDiv = document.getElementById("info");
infoDiv.innerHTML = "<p> Extension OL3 version " + Gp.ol3extVersion + " (" + Gp.ol3extDate + ")</p>";
}
//]]>
})
}
</script>
<div id="map"></div>
<div id="info"></div>
</body>
</html> |
Partager