-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.R
More file actions
34 lines (31 loc) · 1.01 KB
/
map.R
File metadata and controls
34 lines (31 loc) · 1.01 KB
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
30
31
32
33
34
source(rpgm.pgmFilePath('modules/leaflet/main.R'))
# Initialize the map widget
Leaflet.createMap(
'main',
rpgm.step('main', 'leaflet'),
'map',
layer = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
height = 512,
options = list(
center=Leaflet.latLng(48, 2),
zoom=5
),
layerOptions = list(
maxZoom=19,
attribution='© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
)
)
# Create the default icon
file.copy(rpgm.pgmFilePath('modules/leaflet/resources/icon.png'), rpgm.outputFile("leaflet_icon.png"));
leafletIconPath <- if(rpgm.isServer()) rpgm.outputFileURL('leaflet_icon.png') else rpgm.outputFile('leaflet_icon.png')
Leaflet.createIcon('default', list(
iconUrl = leafletIconPath,
iconSize = c(48, 48),
iconAnchor = c(24, 48),
popupAnchor = c(0, -48)
));
# Start loading data when the map is ready
Leaflet.on('main', 'onDidLoad', function(){
Leaflet.showLoading('main');
loadDonnees("Primes", path[["Primes"]])
});