ESRI ArcGIS geo map support (#16059)

This commit is contained in:
Tony Murray 2024-06-05 08:16:33 -05:00 committed by GitHub
parent fa16c025ba
commit 7ac1b3303f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 83 additions and 8 deletions

File diff suppressed because one or more lines are too long

12
html/js/esri-leaflet.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -356,6 +356,53 @@ function init_map(id, config = {}) {
(config.layer in baseMaps ? baseMaps[config.layer] : roads).addTo(leaflet);
leaflet.layerControl._container.style.display = (config.readonly ? 'none' : 'block');
});
} else if (config.engine === 'esri') {
leaflet.setMaxZoom(18);
// use vector maps if we have an API key
if (config.api_key) {
loadjs('js/esri-leaflet.js', function () {
loadjs('js/esri-leaflet-vector.js', function () {
var roads = L.esri.Vector.vectorBasemapLayer("ArcGIS:Streets", {
apikey: config.api_key
});
var topology = L.esri.Vector.vectorBasemapLayer("ArcGIS:Topographic", {
apikey: config.api_key
});
var satellite = L.esri.Vector.vectorBasemapLayer("ArcGIS:Imagery", {
apikey: config.api_key
});
baseMaps = {
"Streets": roads,
"Topography": topology,
"Satellite": satellite
};
leaflet.layerControl = L.control.layers(baseMaps, null, {position: 'bottomleft'}).addTo(leaflet);
(config.layer in baseMaps ? baseMaps[config.layer] : roads).addTo(leaflet);
leaflet.layerControl._container.style.display = (config.readonly ? 'none' : 'block');
});
});
} else {
let attribution = 'Powered by <a href="https://www.esri.com/">Esri</a> | Esri Community Maps Contributors, Maxar, Microsoft, Iowa DNR, © OpenStreetMap, Microsoft, TomTom, Garmin, SafeGraph, GeoTechnologies, Inc, METI/NASA, USGS, EPA, NPS, US Census Bureau, USDA, USFWS';
var roads = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: attribution
});
var topology = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x', {
attribution: attribution
});
var satellite = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: attribution
});
baseMaps = {
"Streets": roads,
"Topography": topology,
"Satellite": satellite
};
leaflet.layerControl = L.control.layers(baseMaps, null, {position: 'bottomleft'}).addTo(leaflet);
(config.layer in baseMaps ? baseMaps[config.layer] : roads).addTo(leaflet);
leaflet.layerControl._container.style.display = (config.readonly ? 'none' : 'block');
}
} else {
leaflet.setMaxZoom(20);
const tile_url = config.tile_url ? config.tile_url : '{s}.tile.openstreetmap.org';

View File

@ -757,6 +757,7 @@ return [
'openstreetmap' => 'OpenStreetMap',
'mapquest' => 'MapQuest',
'bing' => 'Bing Maps',
'esri' => 'ESRI ArcGIS',
],
],
'latlng' => [
@ -765,7 +766,12 @@ return [
],
'layer' => [
'description' => 'Initial Map Layer',
'help' => 'Initial map layer to display when showing various Geo Maps',
'help' => 'Initial map layer to display. *Not all layers are available for all mapping engines.',
'options' => [
'Streets' => 'Streets',
'Sattelite' => 'Sattelite',
'Topography' => 'Topography',
],
],
],
'graphite' => [

View File

@ -1831,7 +1831,8 @@
"value": [
"google",
"mapquest",
"bing"
"bing",
"esri"
]
}
},
@ -1852,7 +1853,8 @@
"google": "Google Maps",
"openstreetmap": "OpenStreetMap",
"mapquest": "MapQuest",
"bing": "Bing Maps"
"bing": "Bing Maps",
"esri": "ESRI ArcGIS"
}
},
"geoloc.latlng": {
@ -1879,7 +1881,8 @@
"type": "select",
"options": {
"Streets": "Streets",
"Sattelite": "Sattelite"
"Sattelite": "Sattelite",
"Topography": "Topography"
},
"when": {
"setting": "geoloc.engine",
@ -1887,7 +1890,8 @@
"value": [
"google",
"mapquest",
"bing"
"bing",
"esri"
]
}
},

View File

@ -23,10 +23,11 @@
</div>
<div class="form-group">
<label for="init_layer-{{ $id }}" class="control-label">{{ __('Initial Layer') }}</label>
<label for="init_layer-{{ $id }}" class="control-label" title="{{ __('settings.settings.geoloc.layer.help') }}">{{ __('settings.settings.geoloc.layer.description') }}</label>
<select class="form-control" name="init_layer" id="init_layer-{{ $id }}">
<option value="Streets" @if($init_layer == 'Streets') selected @endif>{{ __('Streets') }}</option>
<option value="Satellite" @if($init_layer == 'Satellite') selected @endif>{{ __('Satellite') }}</option>
<option value="Streets" @if($init_layer == 'Streets') selected @endif>{{ __('settings.settings.geoloc.layer.options.Streets') }}</option>
<option value="Satellite" @if($init_layer == 'Satellite') selected @endif>{{ __('settings.settings.geoloc.layer.options.Satellite') }}</option>
<option value="Topography" @if($init_layer == 'Topography') selected @endif>{{ __('settings.settings.geoloc.layer.options.Topography') }}</option>
</select>
</div>