forked from patrickp-rthinfo/leaflet-color-markers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demoApp.js
29 lines (23 loc) · 891 Bytes
/
demoApp.js
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
/*
Reference: https://stackoverflow.com/questions/50132531/bundle-leaflet-for-use-in-browser
As a demo, and to test this library really works, we have this demo webpage. More info in the README.
*/
// require modules
import * as L from 'leaflet/src/Leaflet';
// create map
const map = L.map('map').setView([51.505, -0.09], 13);
// Use OpenStreetMap tiles and attribution
const osmTiles = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const attribution = '© OpenStreetMap contributors';
// Create the basemap and add it to the map
L.tileLayer(osmTiles, {
maxZoom: 18,
attribution: attribution
}).addTo(map);
// load icon with our library
import { greenIcon } from './js/index.js';
// create and customize our marker
const marker = L.marker([51.5, -0.09], { icon: greenIcon });
marker.bindTooltip("Somewhere in London");
// and then add it to the map
marker.addTo(map);