-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildingLeafletStuff.R
More file actions
38 lines (29 loc) · 1.42 KB
/
BuildingLeafletStuff.R
File metadata and controls
38 lines (29 loc) · 1.42 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
35
36
37
38
#Setup
rm(list=ls(all=TRUE)) # clear memory
packages<- c("maptools","rgdal","leaflet","raster") # list the packages that you'll need
lapply(packages, require, character.only=T) # load the packages, if they don't load you might need to install them first
setwd("E:\\GISWork_2\\Ferri_ImaginaryPlaces2\\Map\\")
latlong <- "+init=epsg:4326"
google <- "+init=epsg:3857"
# image <- stack("First_Trial_CopyRaster.tif") #stack instead of raster for multiband image
image <- stack("Mappa_piccola_rect.tif") #stack instead of raster for multiband image
projection(image) <- google
writeRaster(image,"Mappa_piccola_rect_Crs.tif",overwrite=TRUE)
crs(image) <- sp::CRS(google)
qq <- leaflet() %>%
#setView(lng = 12.5, lat = 41.9, zoom = 12) %>%
# addRasterImage(image) %>%
addTiles(group = "OpenStreetMap") %>% # Add default OpenStreetMap map tiles
addTiles(
"http://www.nd.edu/~msisk1/testing/testing/rect/{z}/{x}/{y}.png",
# "Letarouilly_LoRes/{z}/{x}/{y}.png",
options = tileOptions(tms=TRUE),
group = "Custom"
)
# addLayersControl(
# # baseGroups = c("OpenStreetMap","Custom"),
# overlayGroups = c("OpenStreetMap","Custom"),
# options = layersControlOptions(collapsed = FALSE)
# )
qq
addRasterImage(r, colors = pal, opacity = 0.8)