Skip to content

Commit 1a9bbe0

Browse files
committed
feat: add basemap layers to public maps and rename home tooltip
1 parent 5a62164 commit 1a9bbe0

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

ckanext/spatial/public/js/spatial_query.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ this.ckan.module('spatial-query', function ($, _) {
175175
states: [{
176176
stateName: 'zoom-to-home',
177177
icon: 'fa-home',
178-
title: 'Reset to initial view',
178+
title: 'Zoom out to Texas',
179179
onClick: function(btn, map) {
180180
map.fitBounds([[25.840437651866516, -106.64719063660635], [36.50050935248352, -93.5175532104321]])
181181
}
@@ -293,14 +293,34 @@ this.ckan.module('spatial-query', function ($, _) {
293293
},
294294

295295
_createMap: function(container) {
296+
297+
const baselayers = {
298+
"<span class=\"fs-3\">OSM</span>": L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
299+
maxZoom: 19,
300+
attribution: "&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
301+
}),
302+
"<span class=\"fs-3\">Street</span>": L.tileLayer("https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}.png", {
303+
maxZoom: 19,
304+
// https://www.arcgis.com/home/item.html?id=3b93337983e9436f8db950e38a8629af
305+
attribution: "Tiles © Esri — Sources: Esri, HERE, Garmin, USGS, Intermap, INCREMENT P, NRCAN, Esri Japan, METI, Esri China (Hong Kong), NOSTRA, © OpenStreetMap contributors, and the GIS User Community"
306+
}),
307+
"<span class=\"fs-3\">Photo</span>": L.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.png", {
308+
maxZoom: 19,
309+
// https://doc.arcgis.com/en/data-appliance/2022/maps/world-imagery.htm
310+
attribution: "Tiles © Esri — Sources: Esri, Maxar, Earthstar Geographics, and the GIS User Community"
311+
})
312+
};
296313
map = ckan.commonLeafletMap(
297314
container,
298315
this.options.map_config,
299316
{
317+
layers: [Object.values(baselayers).at(0)],
300318
attributionControl: false,
301319
drawControlTooltips: false,
302-
}
320+
},
303321
);
322+
this.overlays = {};
323+
L.control.layers(baselayers, this.overlays).addTo(map);
304324

305325
return map;
306326

0 commit comments

Comments
 (0)