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
|
//je déclara la map :
var map = new ol.Map({
controls: ol.control.defaults({
.....
//Puis je charge les couches de l'IGN dont j'ai besoin, par exemple, code complet :
var resolutions = [
156543.03392804103,
78271.5169640205,
39135.75848201024,
19567.879241005125,
9783.939620502562,
4891.969810251281,
2445.9849051256406,
1222.9924525628203,
611.4962262814101,
305.74811314070485,
152.87405657035254,
76.43702828517625,
38.218514142588134,
19.109257071294063,
9.554628535647034,
4.777314267823517,
2.3886571339117584,
1.1943285669558792,
0.5971642834779396,
0.29858214173896974,
0.14929107086948493,
0.07464553543474241
] ;
//Flux ne nécessitant plus de clé
var IGNortho = new ol.layer.Tile({
visible:false,
title: 'IGN Ortho - Photographies aériennes',
source : new ol.source.WMTS({
//avant 2022 il fallait une clé pour interroger l'ORTHOPHOTOS
//url: "https://wxs.ign.fr/{XXX-MaCleIGN-XXX}/geoportail/wmts",
url: "https://wxs.ign.fr/essentiels/geoportail/wmts",
layer: "ORTHOIMAGERY.ORTHOPHOTOS",
matrixSet: "PM",
format: "image/jpeg",
style: "normal",
tileGrid : new ol.tilegrid.WMTS({
origin: [-20037508,20037508], // topLeftCorner
resolutions: resolutions, // résolutions
matrixIds: ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"] // ids des TileMatrix
})
})
});
map.addLayer(IGNortho);
//Flux nécessitant une clé
var Scan25 = new ol.layer.Tile({
visible:false,
title: 'IGN Scan25',
source : new ol.source.WMTS({
url: "https://wxs.ign.fr/ {XXX-MaCleIGN-XXX} /geoportail/wmts",
layer: "GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR",
matrixSet: "PM",
format: "image/jpeg",
style: "normal",
tileGrid : new ol.tilegrid.WMTS({
origin: [-20037508,20037508], // topLeftCorner
resolutions: resolutions, // résolutions
matrixIds: ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"] // ids des TileMatrix
})
})
});
map.addLayer(Scan25); |
Partager