ggmap

Add raster to ggmap base map: set alpha (transparency) and fill color to inset_raster() in ggplot2

不羁的心 提交于 2019-11-27 04:42:30
问题 I want to plot a map with a raster overlaying a GoogleMaps base map in ggplot2. Therefore, I used get_map() and insert_raster() like this: library(ggplot2) library(ggmap) bm <- ggmap(get_map(location = "Bangkok", maptype = "hybrid")) bm + inset_raster(as.raster(r), xmin = r@extent[1], xmax = r@extent[2], ymin = r@extent[3], ymax = r@extent[4]) Is there any possibility to set a alpha and change the fill color? The result looks like this: 回答1: Even Faster without fortify : read the original

Get Map with specified boundary coordinates

你。 提交于 2019-11-27 04:21:34
问题 I want to get a map with RgoogleMaps from R, with a specific coordinates boundary. What I can call is GetMap, and specify a center, I must add a zoom level. Everything works fine, except that I am not getting an image map bounded with the coordinates I choose. Here's an example: lat <- c(44.49,44.5) lon <- c(11.33,11.36) center = c(mean(lat), mean(lon)) zoom <- 14 mmap <- GetMap(center = center, zoom=zoom, maptype= "satellite", destfile = "m.png") The problem is that only the center is passed

Filled contour plot with R/ggplot/ggmap

笑着哭i 提交于 2019-11-27 03:34:17
问题 I'm having trouble plotting a filled contour plot on top of a map with ggmap/ggplot2 in R. My data are regularly spaced lat/lon coordinates with a z value indicating rainfall > head( flood ) lat lon rain 1 22.51916 -105.9318 1.486188e-05 2 22.59956 -105.9318 1.735962e-05 3 22.67996 -105.9318 2.024598e-05 4 22.76037 -105.9318 2.357599e-05 5 22.84077 -105.9318 2.741153e-05 6 22.92117 -105.9318 3.182212e-05 After getting the base map with ggmap, I'm trying to overplot filled contours of rain map

Error in get_map using ggmap in R

妖精的绣舞 提交于 2019-11-27 02:33:04
问题 About 90% of the time, when using get_map in ggmap , I get the following error. Can someone please tell me why? map <- get_map(location = 'Australia', zoom = 4) Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=Australia&zoom=4&size=%20640x640&scale=%202&maptype=terrain&sensor=false' In addition: Warning message: In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :

Small ggplot2 plots placed on coordinates on a ggmap

不打扰是莪最后的温柔 提交于 2019-11-27 02:26:14
问题 I would like to first use ggmap to plot a specific area with longitude and latitude as axes. Then I would like to put small ggplot2 plots on the specific locations, given their longitude and latitude. These can be barplots with minimal theme. My database may have the columns: 1. town 2. longitude 3. latitude 4. through 6. value A, B, C I generate a plot (pseudocode) p <- ggmap(coordinates) and I have my minimal ggplot2 design q<-ggplot2()+geom_bar(....)+ ... x-axis null y axis null minimal

get_map not passing the API key (HTTP status was '403 Forbidden')

北慕城南 提交于 2019-11-27 01:46:44
I have been facing this issue in the get_map() function ( ggmap library) in R. My code was running without the need to specify an API key (for source = "google" ) for several months. However, the code stopped working a couple of weeks back. I understood that Google has made the API key mandatory (or maybe they allowed a certain no of calls without the api key which I exhausted). However, even after specifying the API key (obtained from Google Cloud Platform) my code continued behaving the same way. I even contacted Google Cloud Support, but they said there was nothing wrong with the API key

Increase the api limit in ggmap's geocode function (in R)

不想你离开。 提交于 2019-11-27 01:02:38
问题 I'm trying to use the geocode function from the ggmaps library in R to get coordinates for specific locations. I'm able to use the function fine so far. The issue I'm running into is that I would like to increase my daily limit from 2,500 to 100,000 . The official Google documentation says that this is readily possible if you enable billing on the project, which I'm happy to do. When you proceed with this process, the Google Developers Console gives you a personalized API key. However, the

World map with ggmap

旧街凉风 提交于 2019-11-27 00:58:09
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, an integer from 0 (whole world) to 21 (building), default value 10 (city). openstreetmaps limits a zoom of

Error when mapping in ggmap with API key (403 Forbidden)

你说的曾经没有我的故事 提交于 2019-11-26 23:30:00
问题 I normally use ggmap to plot points on a simple city map. When doing this today I came up on a new error that forbids me to use the function get_map() #get API key @ https://developers.google.com/places/web-service/get-api-key key<-"AIzaSyCYgKKt2fn7Crt-V6Hnc5aw5lSfy7XLQ-Y" register_google(key = key) atw<- get_map(location=c(-88.68,42.14), zoom=10, scale=2) I am not sure where the problem is. Ive tried a new API key but no luck. Any input? The error reads: cannot open URL 'https://maps

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

筅森魡賤 提交于 2019-11-26 22:22:08
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. 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_github("hadley/ggplot2") Before that, I also reinstalled all of the packages mentioned here: https://github