Create Map of Points
# load packages
suppressWarnings(suppressPackageStartupMessages({
library(leaflet)
library(rgdal)
}))
# set paths
gdb = 'H:/Fall15/GIS296/lab3new/lab3/golf.gdb'
# read points from geodatabase
pts = readOGR(gdb, 'pts_tree', verbose=F)
# project points to geographic projection
pts_gcs = spTransform(pts, leaflet:::epsg4326)
# create map of points
leaflet() %>%
addTiles() %>%
addMarkers(data = pts_gcs)
create map with Stamen.Terrain basemap
# create map with Stamen.Terrain basemap
leaflet() %>%
addProviderTiles('Stamen.Terrain') %>%
addMarkers(data = pts_gcs, popup=~sprintf('id: %d', id))
read points, lines and polygons from geodatabase
# read points, lines and polygons from geodatabase
pts_gcs = readOGR(gdb, 'pts_tree', verbose=F) %>% spTransform(leaflet:::epsg4326)
lns_gcs = readOGR(gdb, 'lns_cart_proj', verbose=F) %>% spTransform(leaflet:::epsg4326)
plys_gcs = readOGR(gdb, 'plys_bunker', verbose=F) %>% spTransform(leaflet:::epsg4326)
# map with lines and polygons
leaflet() %>%
addProviderTiles('Stamen.Terrain') %>%
addPolygons(data=plys_gcs, stroke = F, color = "orange") %>%
addPolylines(data=lns_gcs) %>%
addMarkers(data=pts_gcs, popup=~sprintf('id: %d', id))