ggmap

Making Multiple Style References In Google Maps API

折月煮酒 提交于 2019-11-26 21:56:52
问题 I cannot figure out how to make multiple style references in one ggmap() query from the Google Maps API in R. Making one query is simple: library(ggmap) map <- get_googlemap("new york city", zoom = 12, maptype = "roadmap", style = c(feature = "poi.medical", element = "geometry", color = "red")) ggmap(map) But let's say I want to make all parks blue as well as hospitals red. How would I go about doing that? I have tried nested concatenation within my style variable, but that doesn't work. Also

ggmap with geom_map superimposed

风流意气都作罢 提交于 2019-11-26 20:27:26
问题 library(sp) library(spdep) library(ggplot2) library(ggmap) library(rgdal) Get and fiddle with data: nc.sids <- readShapePoly(system.file("etc/shapes/sids.shp", package="spdep")[1],ID="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66")) nc.sids=spTransform(nc.sids,CRS("+init=epsg:4326")) Get background map from stamen.com, plot, looks nice: ncmap = get_map(location=as.vector(bbox(nc.sids)),source="stamen",maptype="toner",zoom=7) ggmap(ncmap) Create a data frame with long,lat,Z, and plot

How to put a geom_sf produced map on top of a ggmap produced raster

自作多情 提交于 2019-11-26 16:35:38
问题 I tried the following code: library(ggplot2) library(ggmap) library(sf) nc <- st_read(system.file("shape/nc.shp", package = "sf")) str(nc) Classes ‘sf’ and 'data.frame': 100 obs. of 15 variables: $ AREA : num 0.114 0.061 0.143 0.07 0.153 0.097 0.062 0.091 0.118 0.124 ... $ PERIMETER: num 1.44 1.23 1.63 2.97 2.21 ... $ CNTY_ : num 1825 1827 1828 1831 1832 ... $ CNTY_ID : num 1825 1827 1828 1831 1832 ... $ NAME : Factor w/ 100 levels "Alamance","Alexander",..: 5 3 86 27 66 46 15 37 93 85 ... $

Administrative regions map of a country with ggmap and ggplot2

青春壹個敷衍的年華 提交于 2019-11-26 11:49:37
问题 I can make USA state level unemployment graph with the following code. library(XML) library(ggplot2) library(plyr) library(maps) unemp <- readHTMLTable(\'http://www.bls.gov/web/laus/laumstrk.htm\', colClasses = c(\'character\', \'character\', \'numeric\'))[[2]] names(unemp) <- c(\'rank\', \'region\', \'rate\') unemp$region <- tolower(unemp$region) us_state_map <- map_data(\'state\') map_data <- merge(unemp, us_state_map, by = \'region\') map_data <- arrange(map_data, order) states <- data

World map with ggmap

此生再无相见时 提交于 2019-11-26 09:30:46
问题 I am using ggmap and wish to have a map of the world centered on Australia to which I can easily plot geocoded points. ggmap seems to be a lot easier to use compared to some of the other mapping packages. Yet when I bring through a map using the code below it errors. gc <- geocode(\'australia\') center <- as.numeric(gc) > map <- get_map(location = center, source=\"google\", maptype=\"terrain\", zoom=0) Error: zoom must be a whole number between 1 and 21 From the get_map help: \"zoom: map zoom

ggmap Error: GeomRasterAnn was built with an incompatible version of ggproto

青春壹個敷衍的年華 提交于 2019-11-26 08:17:26
问题 I\'m using ggmap, and got the error below: Error: GeomRasterAnn was built with an incompatible version of ggproto. Please reinstall the package that provides this extension. I\'ve installed the latest version of both ggmap(2.6.1) and ggplot2(2.2.0), but still got the same error. 回答1: I ran into this problem as well today, and I had to install the GitHub development versions of ggplot2 and ggmap and restart R to get rid of this error: devtools::install_github("dkahle/ggmap") devtools::install