Skip to content

Commit

Permalink
Merge pull request #1 from morikuni/add-tile-layer
Browse files Browse the repository at this point in the history
Support multiple layers
  • Loading branch information
morikuni authored Mar 30, 2022
2 parents d3efd26 + 79558c8 commit ccb4929
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ const htmlTemplate = `
center: [0, 0],
zoom: 1,
});
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
// tiles are copied from: https://leaflet-extras.github.io/leaflet-providers/preview/
const Esri_WorldStreetMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
}).addTo(map);
const OpenStreetMap_Mapnik = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
const layers = {
"Esri": Esri_WorldStreetMap,
"OpenStreetMap": OpenStreetMap_Mapnik,
}
L.control.layers(layers).addTo(map);
map.attributionControl.addAttribution('&copy; <a href="https://github.com/morikuni/go-geoplot">go-geoplot</a> by <a href="https://github.com/morikuni">morikuni</a>');
{{ range .lines }}
{{- .}}
Expand Down

0 comments on commit ccb4929

Please sign in to comment.