library(dismo) x <- geocode("Bozner Platz, Innsbruck, Tirol, Austria") e <- extent(unlist(x[4:7])) g <- gmap(e, type = "satellite") plot(g)
27 Nov 2011
..A Quick Geo-Trick for GoogleMaps in R (using dismo)
... I thought this geocoding-bit might be worth sharing (found HERE when searching the web for dismo-documentation).
Subscribe to:
Post Comments
(
Atom
)
This is really cool. Thanks for posting!
ReplyDeleteAlso requires the package rgdal to be loaded. In turn, rgdal needs gdal to be installed (easily available through my distro's package manager)
Just to document that on your blog:
ReplyDeleteI just tried and could not succeed, as dismo has a suggest to the package XML. Which is not supported out of the box, as I learned quickly.
### see: http://cran.r-project.org/bin/windows/contrib/r-release/ReadMe
So, I went there: http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.15/
got the .zip, installed the package, loaded it and: bingo. I am astounded.
THANK you so very much indeed for this. We are working on geocoding literally thousands of locations - and googleMaps/earth is nearly always better georeferenced than any other source available.
######## just to be complete: install the .zip-File like this.
install.packages(
c("..yourpath..\\XML_3.9-4.1.zip"),
repos = NULL,
configure.args = c(XML = '--with-xml-config=xml-config'))
Interesting - had no problems with XML. Anyways, thanks for pointing this up!
ReplyDeleteHey there I'm new to R and I have to make a presentation about geographical maps that you can "design" in R. So I thought this is quite nice but somehow I can not manage to plot my location. In what order do I have to type it in (the first row g). and in the second row what does it mean X[4:7]?
ReplyDeletebesides does anyone of you know any other great geographical maps than you can create in R easily?
thanks a lot
check the R links section from the main menu to get you started..
ReplyDeleteThanks for tryig but somehow this page just appears black on my screen.
ReplyDeleteBut I now have another problem.
The thing is I've got some huuuuge data that I will have to map. The thing is I only have the zipcodes in the data (zips of america and no state names or anything else) but I don't know how to map the zipcodes on the amrican map that I have in my data. Perfect would be if I could leave the ones not appearing ion the data blank or even colour the ones with a lot of participants darker than the ones with less participants.
If you could help me or forward me to another homepage that could help me would be perfect. Thanks a lot
Sry, the link was broken - but is now fixed. Check the links there to get some ideas. BTW, the Google geocoder works also for zip codes. I'm quite confident that there is an R-packages using it.. You'll need to browse the online sources for this..
Delete..just tried it: you can of course also use postal codes with dismo::geocode like so
Deletex <- geocode("A-6071")
e <- extent(unlist(x[4:7]))
g <- gmap(e, type = "satellite")
plot(g)