SDK : WMS INSPIRE
Utilisation de layersOptions pour les couches INSPIRE WMS
by Géoportail IGNF
HTML
<script src="https://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.js"></script>
<link rel="stylesheet" href="https://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.css">
<div id="map"></div>
<div id="info"></div>
CSS
#map {
padding: 5px;
width: 100%;
height: 600px;
box-shadow: 0 0 10px #999;
}
#info {
padding: 5px;
width: 100%;
height: 20px;
font-family: "monospace";
font-size: 10px;
}
JavaScript
var map = Gp.Map.load(
"map", // html div
{
// Geoportal access key obtained here : http://professionnels.ign.fr/ign/contrats
apiKey: "jhyvi0fgmnuxvfv0zjzorvdn",
// layers to display
zoom : 12,
projection : "EPSG:4326",
center : {
x : -61.545,
y : 16.239,
projection : "CRS:84"
},
layersOptions : {
"OI.OrthoimageCoverage" : {},
"BU.Building" : {
queryable : true
}
},
// additional tools to display on the map
controlsOptions : {
"layerSwitcher" : {},
"getfeatureinfo" : {
// activate GFI on BU.Building layer
layers : {
"BU.Building" : {}
}
}
}
}
) ;
var infoDiv = document.getElementById("info");
infoDiv.innerHTML = "<p> SDK version " + Gp.sdkVersion + " (" + Gp.sdkDate + ")</p>";