Browse Source

better base leaflet

Petra Lamborn 3 years ago
parent
commit
915d690143
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      viz/app.R

+ 7
- 6
viz/app.R View File

2
 library(leaflet)
2
 library(leaflet)
3
 library(rgdal)
3
 library(rgdal)
4
 
4
 
5
-sf <- readOGR(dsn="../shapefiles/sa20025WGSfil")
6
-crs <- leafletCRS(proj4def = sf@proj4string,
7
-                  bounds=sf@bbox)
8
-leaflet(sf) %>% addPolygons()
5
+sf <- readOGR(dsn="../shapefiles/sa20025WGSfilcth")
6
+leaflet(sf, options = leafletOptions(minZoom = 3, maxZoom = 13)) %>% 
7
+  addPolygons(color="#000", opacity = 1, weight=1,
8
+                            popup = sf@data$SA22018__1) %>%
9
+  setView(174, -41, 5)
9
 
10
 
10
-# Define UI for application that draws a histogram
11
+# Define UI
11
 ui <- fluidPage(
12
 ui <- fluidPage(
12
 )
13
 )
13
 
14
 
14
-# Define server logic required to draw a histogram
15
+# Define server logic
15
 server <- function(input, output) {
16
 server <- function(input, output) {
16
 }
17
 }
17
 
18