Skip to content
Permalink
Browse files

worldmap: added optional 2nd map layer "satellite"

  • Loading branch information...
vpithart authored and LarsMichelsen committed Jul 4, 2019
1 parent b8c9659 commit 06a342ab8a0e6a8fc15c551085a7dbea80f55822
@@ -1,8 +1,9 @@
1.9.13
Worldmap:
* FIX: worldmap textbox visibility per zoom level
* Configurable OpenStreetMap tile server URL (worldmap_tiles_url)
* Configurable OpenStreetMap tile server URL (worldmap_tiles_{url,attribution})
* Feature: dim openstreetmap colors
* Optional 2nd map layer (satellite imagery)
* FIX: worldmap textbox visibility per zoom level

1.9.12
Core:
@@ -105,7 +105,23 @@ <h2>Description of the sections in detail</h2>
<tr>
<td>worldmap_tiles_url <font color="#ff0000">(new in 1.9.13)</font></td>
<td>https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png</td>
<td>Worldmap uses OpenStreetMap tiles as a map background. The URL specifies where to GET the PNG tile images from.</td>
<td>Worldmap uses OpenStreetMap tiles as default map background. The URL specifies where to GET the PNG tile images from.</td>
</tr>
<tr>
<td>worldmap_tiles_attribution <font color="#ff0000">(new in 1.9.13)</font></td>
<td>&copy; &lt;a href="http://www.openstreetmap.org/copyright"&gt;OpenStreetMap&lt;/a&gt;</td>
<td>Map tiles attribution text (shown in bottom right corner)</td>
</tr>
<tr>
<td>worldmap_satellite_tiles_url<br>
worldmap_satellite_tiles_attribution<br>
<font color="#ff0000">(new in 1.9.13)</font>
</td>
<td></td>
<td>Secondary map background tiles (satellite images) URL and attribution.
When used, the <a href="https://leafletjs.com/reference-1.5.0.html#control-layers">layers control</a>
appears on top right corner of the map.
</td>
</tr>

<tr>
@@ -73,6 +73,11 @@
;
; Public or private mirror of OpenStreetMap tiles server
;worldmap_tiles_url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
;worldmap_tiles_attribution="&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>"
;
; Secondary "satellite" tiles server
;worldmap_satellite_tiles_url=""
;worldmap_satellite_tiles_attribution=""
;
; In some cases NagVis needs to open connections to the internet. The cases are:
; - The new geomap needs access to openstreetmap webservices to be able to fetch
@@ -55,16 +55,29 @@ var ViewWorldmap = ViewMap.extend({

initWorldmap: function() {
L.Icon.Default.imagePath = oGeneralProperties.path_base+'/frontend/nagvis-js/images/leaflet';
var layers = {
"map": L.tileLayer(oGeneralProperties.worldmap_tiles_url, {
attribution: oGeneralProperties.worldmap_tiles_attribution,
noWrap: true, // don't repeat the world on horizontal axis
detectRetina: true, // look nice on high resolution screens
}),
}
if(oGeneralProperties.worldmap_satellite_tiles_url) {
layers.satellite = L.tileLayer(oGeneralProperties.worldmap_satellite_tiles_url, {
attribution: oGeneralProperties.worldmap_satellite_tiles_attribution,
noWrap: true, // don't repeat the world on horizontal axis
detectRetina: true, // look nice on high resolution screens
})
}
g_map = L.map('map', {
markerZoomAnimation: false,
maxBounds: [ [-85,-180.0], [85,180.0] ],
minZoom: 2
minZoom: 2,
layers: [layers.map]
}).setView(getViewParam('worldmap_center').split(','), parseInt(getViewParam('worldmap_zoom')));
L.tileLayer(oGeneralProperties.worldmap_tiles_url, {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
noWrap: true, // don't repeat the world on horizontal axe
detectRetina: true, // look nice on high resolution screens
}).addTo(g_map);

if (layers.satellite)
L.control.layers(layers).addTo(g_map);

g_map_objects = L.layerGroup().addTo(g_map);

@@ -159,6 +159,21 @@ public function __construct() {
'default' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'match' => MATCH_STRING_URL,
),
'worldmap_tiles_attribution' => array(
'must' => 0,
'default' => '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
'match' => MATCH_ALL
),
'worldmap_satellite_tiles_url' => array(
'must' => 0,
'default' => '',
'match' => MATCH_STRING_URL,
),
'worldmap_satellite_tiles_attribution' => array(
'must' => 0,
'default' => '',
'match' => MATCH_ALL
),
'http_proxy' => array(
'must' => 0,
@@ -2191,6 +2206,10 @@ public function parseGeneralProperties() {
'header_show_states' => intval($this->getValue('defaults', 'header_show_states')),
'zoom_scale_objects' => intval($this->getValue('defaults', 'zoom_scale_objects')),
'worldmap_tiles_url' => $this->getValue('global', 'worldmap_tiles_url'),
'worldmap_tiles_attribution' => $this->getValue('global', 'worldmap_tiles_attribution'),
'worldmap_satellite_tiles_url' => $this->getValue('global', 'worldmap_satellite_tiles_url'),
'worldmap_satellite_tiles_attribution' => $this->getValue('global', 'worldmap_satellite_tiles_attribution'),
// Add custom action configuration
);
// Add custom action configuration

0 comments on commit 06a342a

Please sign in to comment.
You can’t perform that action at this time.