OpenLayers Workshop missing ol.js library

79 views Asked by At

At the first step in workshop we try to create a basic map.

Here is the code for a map.html

<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="node_modules/ol/ol.css" type="text/css">
    <style>
      #map {
        height: 256px;
        width: 512px;
      }
    </style>
    <title>OpenLayers example</title>
    <script src="node_modules/js-yaml/lib/loader.js" type="text/javascript"></script>
  </head>
  <body>
    <h1>My Map</h1>
    <div id="map"></div>
    <script type="text/javascript">
      var map = new ol.Map({
        target: 'map',
        layers: [
          new ol.layer.Tile({
            title: 'Global Imagery',
            source: new ol.source.TileWMS({
              url: 'https://ahocevar.com/geoserver/wms',
              params: {LAYERS: 'nasa:bluemarble', TILED: true}
            })
          })
        ],
        view: new ol.View({
          projection: 'EPSG:4326',
          center: [0, 0],
          zoom: 0,
          maxResolution: 0.703125
        })
      });

    </script>
  </body>
</html>

After run this code, i suppose to view this map

https://openlayers.org/workshop/fr/basics/map.html

But, i have this two errors messages

enter image description here enter image description here

First of all i am suprised that in the line code of tutorial there not the ol.js library yet we can see that the ol function which is used to display on the map.

Then when i import the missing library i get this error

error

0

There are 0 answers