[R] ggmap crash
R. Michael Weylandt
michael.weylandt at gmail.com
Sat Mar 17 00:26:25 CET 2012
I don't have access to h_raster so I can't reproduce your script
exactly; leaving the annotation_raster() part out seems to work ok.
dput() may be helpful for sending data.
Also, what's your sessionInfo()?
Michael
On Fri, Mar 16, 2012 at 4:59 PM, Hasan Diwan <hasan.diwan at gmail.com> wrote:
> Not sure if this is the right place to report this, but:
>
> Am using ggmap to generate a map of a bounding box from 161
> latitude/longitude pairs and the code crashes R (in ess). Data is at
> http://analysis.d8u.us/~hdiwan/plotSource.csv and the code to read it
> is below. I'm not sure if ess, emacs, ggmap, R, or my laptop is to
> blame. Here's the code:
>> rmc <- read.csv('http://analysis.d8u.us/~hdiwan/rmc.csv', header=TRUE)
>> siteLat = c(as.numeric(rmc$latitude))
>> siteLon = c(as.numeric(rmc$longitude))
>> sites <- as.data.frame(cbind(siteLat, siteLon, ''))
>> lats <- c(floor(min(siteLat))-10, ceiling(max(siteLat))+10)
>> lons <- c(floor(min(siteLon))-10, ceiling(max(siteLon))+10)
>> map <- GetMap.bbox(c(min(siteLon)-5, max(siteLon)+5), c(min(siteLat)-5, max(siteLat)+5), maptype='satellite')
> [1] "http://maps.google.com/maps/api/staticmap?center=53.277508,-9.011888&zoom=5&size=640x640&maptype=satellite&format=png32&sensor=true"
>> lonr <- c(map$BBOX$ll[2], map$BBOX$ur[2])
>> latr <- c(map$BBOX$ll[1], map$BBOX$ur[1])
>> lonr <- c(map$BBOX$ll[2], map$BBOX$ur[2])
>> latr <- c(map$BBOX$ll[1], map$BBOX$ur[1])
>> ggplot(sites, aes(siteLon, siteLat)) + annotation_raster(h_raster, lonr[1], lonr[2], latr[1], latr[2]) + geom_point(aes(x=siteLon, y=siteLat), colour='red', data = sites)
>
> *** caught segfault ***
> address 0x196188000, cause 'memory not mapped'
>
>
> Traceback:
> 1: grid.Call.graphics(L_raster, x$raster, x$x, x$y, x$width,
> x$height, resolveHJust(x$just, x$hjust), resolveVJust(x$just,
> x$vjust), x$interpolate)
> 2: drawDetails.rastergrob(x, recording = FALSE)
> 3: drawDetails(x, recording = FALSE)
> 4: drawGrob(x)
> 5: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
> 6: grid.draw.grob(x$children[[i]], recording = FALSE)
> 7: grid.draw(x$children[[i]], recording = FALSE)
> 8: drawGTree(x)
> 9: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
> 10: grid.draw.gTree(x$children[[i]], recording = FALSE)
> 11: grid.draw(x$children[[i]], recording = FALSE)
> 12: drawGTree(x)
> 13: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
> 14: grid.draw.gTree(gtable_gTree(x), recording)
> 15: grid.draw(gtable_gTree(x), recording)
> 16: grid.draw.gtable(gtable)
> 17: grid.draw(gtable)
> 18: print.ggplot(list(data = list(siteLat = c(53.277465, 53.277482,
> 53.277533, 53.277608, 53.277657, 53.277673, 53.277658, 53.277643,
> 53.27763, 53.27763, 53.277642, 53.277645, 53.277642, 53.277637,
> 53.277637, 53.277645, 53.277648, 53.277645, 53.27764, 53.277637,
> 53.277628, 53.27762, 53.277612, 53.277598, 53.277593, 53.277607,
> 53.277603, 53.277605, 53.27761, 53.277617, 53.277623, 53.277632,
> 53.277632, 53.277632, 53.27763, 53.277628, 53.277628, 53.277628,
> 53.277628, 53.277638, 53.277643, 53.277653, 53.277663, 53.277665,
> 53.277667, 53.277668, 53.27767, 53.277688, 53.277688, 53.277692,
> 53.2777, 53.277703, 53.277705, 53.277707, 53.277708, 53.277708,
> 53.277707, 53.277705, 53.277703, 53.277703, 53.277702, 53.277702,
> 53.2777, 53.277698, 53.277697, 53.277695, 53.27769, 53.277702,
> 53.27771, 53.277712, 53.277715, 53.277725, 53.277725, 53.277725,
> 53.277723, 53.277723, 53.277723, 53.277722, 53.27772, 53.277718,
> 53.27772, 53.277715, 53.277707, 53.277688, 53.27769, 53.27769,
> 53.277685, 53.277677, 53.277673, 53.277678, 53.277687, 53.277695,
> 53.277702, 53.277702, 53.277703, 53.2777, 53.277695, 53.277707,
> 53.277718, 53.277728, 53.277742, 53.277753, 53.277748, 53.277742,
> 53.277747, 53.27774, 53.277748, 53.277742, 53.277735, 53.277728,
> 53.277743, 53.277735, 53.27773, 53.277727, 53.277718, 53.27771,
> 53.277713, 53.277707, 53.277692, 53.277688, 53.277682, 53.27767,
> 53.277662, 53.277652, 53.277645, 53.277645, 53.277632, 53.277617,
> 53.277603, 53.277597, 53.277593, 53.277585, 53.277575, 53.277567,
> 53.277555, 53.277548, 53.277535, 53.277535, 53.277528, 53.277522,
> 53.277513, 53.277503, 53.277493, 53.277482, 53.277472, 53.277457,
> 53.277458, 53.277448, 53.277453, 53.277445, 53.277438, 53.27743,
> 53.277435, 53.277427, 53.277435, 53.277427, 53.277418, 53.277423,
> 53.277417, 53.27741, 53.277413, 53.277415, 53.277428, 53.277433,
> 53.277438, 53.277438, 53.277435, 53.27744, 53.277435, 53.277433,
> 53.277448, 53.277442, 53.277445, 53.27744, 53.27744, 53.277438,
> 53.277438, 53.277437, 53.277433, 53.277428, 53.277415, 53.277403,
> 53.27739, 53.277382, 53.277372, 53.277357, 53.27734, 53.277322,
> 53.2773, 53.27728, 53.277263), siteLon = c(-9.01199, -9.011975,
> -9.011978, -9.01198, -9.011932, -9.011922, -9.011915, -9.011912,
> -9.011907, -9.011923, -9.011932, -9.011945, -9.011958, -9.01197,
> -9.011977, -9.011977, -9.01196, -9.01194, -9.011913, -9.011905,
> -9.011907, -9.0119, -9.011903, -9.011903, -9.011905, -9.011912,
> -9.011895, -9.011903, -9.011908, -9.011903, -9.011898, -9.011887,
> -9.011885, -9.011885, -9.011883, -9.011883, -9.011885, -9.011885,
> -9.011887, -9.011892, -9.011897, -9.011895, -9.011903, -9.011907,
> -9.011908, -9.011912, -9.011915, -9.011922, -9.011915, -9.011918,
> -9.011927, -9.011932, -9.011932, -9.011933, -9.011932, -9.011932,
> -9.011932, -9.01193, -9.011928, -9.011928, -9.011928, -9.011928,
> -9.011928, -9.011928, -9.011927, -9.011923, -9.011928, -9.011925,
> -9.011928, -9.011932, -9.011923, -9.011912, -9.01191, -9.011908,
> -9.011907, -9.011907, -9.011907, -9.011907, -9.011908, -9.011908,
> -9.011913, -9.011917, -9.011923, -9.01194, -9.011943, -9.011958,
> -9.01196, -9.011963, -9.011973, -9.011978, -9.011978, -9.01198,
> -9.011985, -9.011992, -9.011998, -9.011995, -9.011993, -9.01199,
> -9.011977, -9.011958, -9.011957, -9.011925, -9.011917, -9.011907,
> -9.011898, -9.011892, -9.011898, -9.011897, -9.011893, -9.011888,
> -9.011897, -9.011892, -9.0119, -9.01191, -9.011908, -9.011905,
> -9.011912, -9.011903, -9.011895, -9.011878, -9.011872, -9.011865,
> -9.01187, -9.011868, -9.011857, -9.011843, -9.011838, -9.011835,
> -9.01183, -9.011837, -9.011847, -9.011845, -9.011847, -9.011842,
> -9.011833, -9.011827, -9.01182, -9.011813, -9.011815, -9.01181,
> -9.01181, -9.011812, -9.011812, -9.01181, -9.011808, -9.011812,
> -9.011822, -9.01182, -9.01183, -9.01183, -9.011828, -9.011827,
> -9.01183, -9.011827, -9.011827, -9.011823, -9.011822, -9.011825,
> -9.011822, -9.01182, -9.011833, -9.011842, -9.011863, -9.011867,
> -9.011872, -9.011882, -9.011882, -9.011888, -9.011895, -9.011903,
> -9.011908, -9.011908, -9.011903, -9.011903, -9.011893, -9.011897,
> -9.011895, -9.011885, -9.01188, -9.01188, -9.011875, -9.011877,
> -9.011867, -9.011857, -9.011853, -9.01184, -9.011827, -9.011815,
> -9.011788, -9.011778, -9.01178)), layers = list(<environment>,
> <environment>), scales = <S4 object of class "Scales">, mapping =
> list( x = siteLon, y = siteLat), options = list(labels = list(x =
> "siteLon", y = "siteLat")), coordinates = list(limits = list(x =
> NULL, y = NULL), wise = FALSE), facet = list(shrink = TRUE),
> plot_env = <environment>))
> 19: print(list(data = list(siteLat = c(53.277465, 53.277482,
> 53.277533, 53.277608, 53.277657, 53.277673, 53.277658, 53.277643,
> 53.27763, 53.27763, 53.277642, 53.277645, 53.277642, 53.277637,
> 53.277637, 53.277645, 53.277648, 53.277645, 53.27764, 53.277637,
> 53.277628, 53.27762, 53.277612, 53.277598, 53.277593, 53.277607,
> 53.277603, 53.277605, 53.27761, 53.277617, 53.277623, 53.277632,
> 53.277632, 53.277632, 53.27763, 53.277628, 53.277628, 53.277628,
> 53.277628, 53.277638, 53.277643, 53.277653, 53.277663, 53.277665,
> 53.277667, 53.277668, 53.27767, 53.277688, 53.277688, 53.277692,
> 53.2777, 53.277703, 53.277705, 53.277707, 53.277708, 53.277708,
> 53.277707, 53.277705, 53.277703, 53.277703, 53.277702, 53.277702,
> 53.2777, 53.277698, 53.277697, 53.277695, 53.27769, 53.277702,
> 53.27771, 53.277712, 53.277715, 53.277725, 53.277725, 53.277725,
> 53.277723, 53.277723, 53.277723, 53.277722, 53.27772, 53.277718,
> 53.27772, 53.277715, 53.277707, 53.277688, 53.27769, 53.27769,
> 53.277685, 53.277677, 53.277673, 53.277678, 53.277687, 53.277695,
> 53.277702, 53.277702, 53.277703, 53.2777, 53.277695, 53.277707,
> 53.277718, 53.277728, 53.277742, 53.277753, 53.277748, 53.277742,
> 53.277747, 53.27774, 53.277748, 53.277742, 53.277735, 53.277728,
> 53.277743, 53.277735, 53.27773, 53.277727, 53.277718, 53.27771,
> 53.277713, 53.277707, 53.277692, 53.277688, 53.277682, 53.27767,
> 53.277662, 53.277652, 53.277645, 53.277645, 53.277632, 53.277617,
> 53.277603, 53.277597, 53.277593, 53.277585, 53.277575, 53.277567,
> 53.277555, 53.277548, 53.277535, 53.277535, 53.277528, 53.277522,
> 53.277513, 53.277503, 53.277493, 53.277482, 53.277472, 53.277457,
> 53.277458, 53.277448, 53.277453, 53.277445, 53.277438, 53.27743,
> 53.277435, 53.277427, 53.277435, 53.277427, 53.277418, 53.277423,
> 53.277417, 53.27741, 53.277413, 53.277415, 53.277428, 53.277433,
> 53.277438, 53.277438, 53.277435, 53.27744, 53.277435, 53.277433,
> 53.277448, 53.277442, 53.277445, 53.27744, 53.27744, 53.277438,
> 53.277438, 53.277437, 53.277433, 53.277428, 53.277415, 53.277403,
> 53.27739, 53.277382, 53.277372, 53.277357, 53.27734, 53.277322,
> 53.2773, 53.27728, 53.277263), siteLon = c(-9.01199, -9.011975,
> -9.011978, -9.01198, -9.011932, -9.011922, -9.011915, -9.011912,
> -9.011907, -9.011923, -9.011932, -9.011945, -9.011958, -9.01197,
> -9.011977, -9.011977, -9.01196, -9.01194, -9.011913, -9.011905,
> -9.011907, -9.0119, -9.011903, -9.011903, -9.011905, -9.011912,
> -9.011895, -9.011903, -9.011908, -9.011903, -9.011898, -9.011887,
> -9.011885, -9.011885, -9.011883, -9.011883, -9.011885, -9.011885,
> -9.011887, -9.011892, -9.011897, -9.011895, -9.011903, -9.011907,
> -9.011908, -9.011912, -9.011915, -9.011922, -9.011915, -9.011918,
> -9.011927, -9.011932, -9.011932, -9.011933, -9.011932, -9.011932,
> -9.011932, -9.01193, -9.011928, -9.011928, -9.011928, -9.011928,
> -9.011928, -9.011928, -9.011927, -9.011923, -9.011928, -9.011925,
> -9.011928, -9.011932, -9.011923, -9.011912, -9.01191, -9.011908,
> -9.011907, -9.011907, -9.011907, -9.011907, -9.011908, -9.011908,
> -9.011913, -9.011917, -9.011923, -9.01194, -9.011943, -9.011958,
> -9.01196, -9.011963, -9.011973, -9.011978, -9.011978, -9.01198,
> -9.011985, -9.011992, -9.011998, -9.011995, -9.011993, -9.01199,
> -9.011977, -9.011958, -9.011957, -9.011925, -9.011917, -9.011907,
> -9.011898, -9.011892, -9.011898, -9.011897, -9.011893, -9.011888,
> -9.011897, -9.011892, -9.0119, -9.01191, -9.011908, -9.011905,
> -9.011912, -9.011903, -9.011895, -9.011878, -9.011872, -9.011865,
> -9.01187, -9.011868, -9.011857, -9.011843, -9.011838, -9.011835,
> -9.01183, -9.011837, -9.011847, -9.011845, -9.011847, -9.011842,
> -9.011833, -9.011827, -9.01182, -9.011813, -9.011815, -9.01181,
> -9.01181, -9.011812, -9.011812, -9.01181, -9.011808, -9.011812,
> -9.011822, -9.01182, -9.01183, -9.01183, -9.011828, -9.011827,
> -9.01183, -9.011827, -9.011827, -9.011823, -9.011822, -9.011825,
> -9.011822, -9.01182, -9.011833, -9.011842, -9.011863, -9.011867,
> -9.011872, -9.011882, -9.011882, -9.011888, -9.011895, -9.011903,
> -9.011908, -9.011908, -9.011903, -9.011903, -9.011893, -9.011897,
> -9.011895, -9.011885, -9.01188, -9.01188, -9.011875, -9.011877,
> -9.011867, -9.011857, -9.011853, -9.01184, -9.011827, -9.011815,
> -9.011788, -9.011778, -9.01178)), layers = list(<environment>,
> <environment>), scales = <S4 object of class "Scales">, mapping =
> list(x = siteLon, y = siteLat), options = list(labels = list(x
> = "siteLon", y = "siteLat")), coordinates = list(limits =
> list(x = NULL, y = NULL), wise = FALSE), facet = list(shrink =
> TRUE), plot_env = <environment>))
>
> I'd rather use OSM tiles instead of Google, but having something is
> better than the crash above. So, help? Many thanks! -- H
>
> --
> Sent from my mobile device
> Envoyait de mon portable
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list