Questions tagged [ggmap]

A package for plotting maps in R with ggplot2

is an package that allows for the easy visualization of spatial data and models on top of Google Maps, OpenStreetMaps, or Stamen Maps using .

Resources:

1005 questions
11
votes
4 answers

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

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…
Venky
  • 111
  • 1
  • 1
  • 3
11
votes
2 answers

How to use the Google satellite view as tile in leaflet with R

Many questions seem similar to mine, I could not however find a fitting answer for R. So far, I use the awesome R leaflet (and ggmap) package that way: library(ggmap) library(leaflet) coord <-geocode('New York') map.city <- leaflet() %>% …
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54
11
votes
2 answers

Loop for Reverse Geocoding in R

I am trying to reverse geocode a large data-set (around 100k). I used the revgeocode function from the package ggmap. I got the result for 1 entry 48 Grand View Terrace, San Francisco, CA 94114, USA 48 Grand View Terrace Eureka Valley…
marine8115
  • 588
  • 3
  • 22
11
votes
2 answers

Add a circle to ggmap

Let's assume I generate a map of London using ggmap package: library(ggmap) library(mapproj) map <- get_map(location = "London", zoom = 11, maptype = "satellite") p <- ggmap(map)+ theme(legend.position = "none") print(p) Now I would like…
Michał
  • 273
  • 1
  • 3
  • 13
11
votes
1 answer

geom_text not working when ggmap and geom_point used

HI I am using ggmap and gg_point function to show the measured data in an estuary. The code that I used is as follows: library(ggmap) al1 <- get_map(location = c(lon = -87.525, lat = 30.35), zoom = 12, maptype = 'terrain') lon<-…
Jd Baba
  • 5,948
  • 18
  • 62
  • 96
10
votes
4 answers

ggmap error (Error in as.vector(y) : attempt to apply non-function)

I'm doing relatively simple things with ggmap and am confused because code that runs fine on my mac does not run on my PC. I run this code: library(ggmap) map <- get_map(location = c(-122.175, 37.45635), maptype = "terrain", …
leb112358
  • 101
  • 1
  • 4
10
votes
2 answers

Parsimonious way to add north arrow and scale bar to ggmap

I am trying to use ggmap to create a map of the protected areas I am working in with a satellite image from google earth underneath. I can make a very satisfactory image except that it lacks a north arrow and scale bar: I'm aware that there are…
James
  • 1,164
  • 2
  • 15
  • 36
10
votes
2 answers

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

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 +…
loki
  • 9,816
  • 7
  • 56
  • 82
10
votes
2 answers

How do I plot US cities using ggplot?

I can plot the state of Louisiana just fine... require(ggplot2) require(ggmap) require(maps) LA <- map_data("state", region="louisiana") ggplot(LA, aes(x=long, y=lat))+geom_polygon() Now, I have data on how many sales calls were made to…
Ben
  • 20,038
  • 30
  • 112
  • 189
10
votes
1 answer

ggmap with geom_map superimposed

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…
Spacedman
  • 92,590
  • 12
  • 140
  • 224
9
votes
3 answers

Error in ggmap, "must be an array" and "HTTP 400 bad request"

I'm trying to call a map from google maps using ggmap. Example code: get_googlemap(center = c(lon = -56.67, lat = 51.47), zoom = 8, size = c(640, 640), scale = 2, format = "png8", maptype = "satellite") However, this returns the…
Hunter Stevens
  • 251
  • 2
  • 7
9
votes
1 answer

Draw curved lines in ggmap, geom_curve not working

I would like to make a map of the Netherlands with curved lines between cities. I have two dataframes number one called: df_verticles which contains 24 cities with their lat/lon combination. The second dataframe called: df i want to use to draw a…
M. Kooi
  • 245
  • 3
  • 17
9
votes
2 answers

ggmap changing size of map

I would like to create a map that is not perfectly square but rectangular and is the size I dictate. require(ggmap) tenmile <- get_map(location = c(lon = -122.486328, lat = 48.862813), color = "color", source = "google", maptype =…
Danielle Love
  • 121
  • 1
  • 4
9
votes
3 answers

Applying revgeocode to a list of longitude-latitude coordinates

I'm trying to get the Zip codes of a (long) list of Longitude Latitude coordinates by using the revgeodcode function in the ggmap library. My question & data are the same as here: Using revgeocode function in a FOR loop. Help required but the…
Rutger
  • 129
  • 1
  • 6
9
votes
1 answer

Create ggmap with points, faceted, and each facet zoomed appropriately?

I want to plot data points for various cities over a greyed-out map from google. As these cities are some distance from each other, I thought I would use a faceted plot. Creating the map is easy enough; see image and code below. However, each facet…
SlowLearner
  • 7,907
  • 11
  • 49
  • 80
1 2
3
66 67