SimonGoring / neotoma_paper

Repository for the neotoma package paper.
MIT License
3 stars 2 forks source link

ggmap() usage returning an error and not a plot #4

Closed gavinsimpson closed 10 years ago

gavinsimpson commented 10 years ago

In the code block

bc.map <- get_map(location = c(-120, 60), zoom = 4)

ggmap(bc.map) +
  geom_point(data = all.sites, aes(x = long, y = lat)) +
  geom_point(data = get_site(dataset = all.datasets), 
             aes(x = long, y = lat), 
             color = 2) +
  xlab('Longitude West') + ylab('Latitude North')

I am seeing the following behaviour:

> bc.map <- get_map(location = c(-120, 60), zoom = 4)
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=60,-120&zoom=4&size=%20640x640&scale=%202&maptype=terrain&sensor=false
Google Maps API Terms of Service : http://developers.google.com/maps/terms
> 
> ggmap(bc.map) +
+   geom_point(data = all.sites, aes(x = long, y = lat)) +
+   geom_point(data = get_site(dataset = all.datasets), 
+              aes(x = long, y = lat), 
+              color = 2) +
+   xlab('Longitude West') + ylab('Latitude North')
Error: Request-URI Too Long

This is with

> sessionInfo()
R version 3.1.0 Patched (2014-05-26 r65771)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_CA.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_CA.utf8        LC_COLLATE=en_CA.utf8    
 [5] LC_MONETARY=en_CA.utf8    LC_MESSAGES=en_CA.utf8   
 [7] LC_PAPER=en_CA.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_CA.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] mapproj_1.2-2   maps_2.3-7      gridExtra_0.9.1 Bchron_4.1.1   
 [5] inline_0.3.13   plyr_1.8.1      reshape2_1.4    ggmap_2.3      
 [9] ggplot2_1.0.0   neotoma_1.0-1   devtools_1.5   

loaded via a namespace (and not attached):
 [1] coda_0.16-1         colorspace_1.2-4    digest_0.6.4       
 [4] ellipse_0.3-8       evaluate_0.5.5      gtable_0.1.2       
 [7] hdrcde_3.1          httr_0.4            lattice_0.20-29    
[10] MASS_7.3-33         mclust_4.3          memoise_0.2.1      
[13] munsell_0.4.2       parallel_3.1.0      png_0.1-7          
[16] proto_0.3-10        Rcpp_0.11.2         RCurl_1.95-4.3     
[19] RgoogleMaps_1.2.0.6 rjson_0.2.14        RJSONIO_1.3-0      
[22] scales_0.2.4        stringr_0.6.2       tools_3.1.0        
[25] whisker_0.3-2
SimonGoring commented 10 years ago

Yes this is new behavior, since I last compiled it anyway. I've tried tracking down the error but don't seem to be coming up with anything. I think I'm just going to drop the maps anyway, since it's probably easier in publication to use free maps.

SimonGoring commented 10 years ago

The source of the problem wasn't in ggmap but in the get_site call. The function hadn't been fixed yet to pull sites out of dataset objects. This is fixed in https://github.com/ropensci/neotoma/commit/aa5a01dc36537c79d2c9bb4d07b63500ab45c4e8 but I changed to the ggmap world map anyway.