'openlayers : tile layer from v 5.3.0 to v 6.12.0
I try to update this layer from ol v 5.3.0 to 6.12.0 and the error is "ReferenceError: TileLayer is not defined" as if the function was not loaded from the ol library call :
<link rel="stylesheet" type="text/css" href="/iliad/bibliotheques_javascript/olv6.12.0/css/ol.css">
<script type="text/javascript" src="/iliad/bibliotheques_javascript/olv6.12.0/build/ol.js" data-url="/iliad/autoconfINRAP.json"></script>
the layer code en v5.3.0
var osmLyr = new ol.layer.Tile({
olParams: {
crossOrigin: "Anonymous",
},
source: new ol.source.OSM(),
opacity: 1,
name: 'Carte Osm',
description: "carte open street map, https://www.openstreetmap.org"
});
and the v6.12.0 code
var osmLyr = new TileLayer({
source: new OSM(),
sourceParams: {
crossOrigin: "Anonymous"
},
opacity: 1,
name: 'Carte Osm',
description: "carte open street map, https://www.openstreetmap.org"
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
