Houston crime map -- slow to produce?

20 views
Skip to first unread message

John Goldin

unread,
Jun 28, 2011, 2:14:27 PM6/28/11
to ggplot2
I am trying to do something based on David Kahle's contest-winning
Houston crime map.
from: https://github.com/hadley/ggplot2/wiki/Crime-in-Downtown-Houston,-Texas-:-Combining-ggplot2-and-Google-Maps

I'm on a Mac and I successfully managed to install rimage so that I
could run RgoogleMaps.

His code that sets up the Houston map is as follows:

CityHall_latlon <- c(lon = -95.369318, lat = 29.760210)
DowntownMap <-ggooglemap(center = CityHall_latlon, zoom = 14)

qplot(lon, lat, data = DowntownMap, geom = 'tile', fill = fill) +
scale_fill_identity() +
scale_x_continuous('Longitude') +
scale_y_continuous('Latitude') +
coord_equal() +
opts(title = 'Terrain Map of Downtown Houston')

When I run this as is, I haven't had enough patience to wait for it to
complete. I tried doing slices with subsets of DowntownMap[1:5000,].
I do get a ggplot with the correct thin slice of the google map in the
plot. Based on some crude timing with different sizes, I estimate it
would take me over 7 hours to get the complete plot (running on my 2.8
GHz Intel Core 2 Duo iMac). I've got 4 gig of RAM and while it runs
it looks like there is 1 gig of RAM free.

Does 7+ hours sound like a reasonable time estimate?

My system:
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
other attached packages:
[1] rimage_0.5-8.2 MASS_7.3-13 RgoogleMaps_1.1.9.7
ReadImages_0.1.3.1 ggplot2_0.8.9 proto_0.3-9.2
[7] reshape_0.8.4 plyr_1.5.2

It has 640 x 640 tiles so maybe this speed is not unreasonable. I
could run it over night. One reason I am asking about this is that I
would swear that near the beginning of my experiments I got it to run
much more quickly on one occasion. But after lots of additional
experimentation, I have concluded that's just another example of the
unreliability of eyewitness testimony. Given that I had to fool
around quite a bit trying to install rimage and rgdal (which I don't
really need) I wondered whether I got something screwed up that
affected the speed.

--John
Reply all
Reply to author
Forward
0 new messages