Files
openlayers/src/ol
2018-07-18 15:40:39 +02:00
..
2018-07-17 14:56:19 -06:00
2017-12-15 15:21:25 +01:00
2018-07-17 16:21:54 +02:00
2018-07-17 17:48:27 -06:00
2018-07-17 17:54:24 -06:00
2018-07-18 12:09:04 +02:00
2018-07-18 12:09:04 +02:00
2018-07-18 12:19:15 +02:00
2018-07-18 00:45:19 -06:00
2017-12-18 10:33:41 +01:00
2018-04-27 10:10:49 +02:00
2018-06-29 09:31:59 +02:00
2018-07-17 11:49:37 +02:00
2018-04-27 09:30:51 +02:00
2017-12-15 15:21:25 +01:00
2018-07-17 09:59:00 +02:00
2018-07-17 13:28:27 +02:00
2017-12-15 15:21:25 +01:00
2018-06-21 18:29:20 +02:00
2018-07-17 09:59:00 +02:00
2017-12-14 12:23:06 -07:00
2018-07-17 13:49:53 +02:00
2018-07-17 14:15:32 +02:00
2017-12-15 15:21:25 +01:00
2018-01-12 00:50:30 -07:00
2018-01-16 14:14:17 +01:00
2018-07-17 14:15:32 +02:00
2018-05-10 17:14:17 +02:00
2018-06-21 11:16:57 +02:00
2018-07-17 14:15:33 +02:00
2017-12-15 15:21:25 +01:00
2018-05-17 12:29:22 -05:00
2018-01-19 15:38:21 +01:00
2018-04-27 09:30:51 +02:00
2018-07-17 14:15:34 +02:00
2018-07-17 09:59:00 +02:00
2017-12-15 15:21:25 +01:00
2018-01-16 13:35:27 +01:00
2018-07-11 11:01:34 +02:00
2018-07-17 14:20:48 +02:00
2017-12-15 15:21:25 +01:00
2017-12-15 15:21:25 +01:00
2018-07-17 14:48:17 -06:00
2018-07-17 14:21:50 +02:00

ol

OpenLayers as ES modules.

Usage

Add the ol package as a dependency to your project.

npm install ol --save

Import just what you need for your application:

import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import XYZ from 'ol/source/XYZ';

new Map({
  target: 'map',
  layers: [
    new TileLayer({
      source: new XYZ({
        url: 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
      })
    })
  ],
  view: new View({
    center: [0, 0],
    zoom: 2
  })
});

See the following examples for more detail on bundling OpenLayers with your application:

Module Identifiers

The module identifiers shown in the above snippet (e.g. ol/Map, note the CamelCase module name) are default exports of constructors. There are also modules like 'ol/proj' (note the lowercase module name), which provide named exports for utility functions and constants, e.g.

import {fromLonLat} from 'ol/proj';

map.setCenter(fromLonLat([16, 48]));

See the API documentation for a reference of all modules, and just keep in mind: CamelCase modules provide a default export, lowercase modules provide named exports.