Skip to content

RgoogleMaps

4 messages · Meesters, Erik, Tomislav Hengl, Robert J. Hijmans

#
Hi,

I have been breaking my head with this problem some time ago and then I 
got it running some time ago.

See p. 103-104 in [http://spatial-analyst.net/book/download?size=thumbnail]

Here is an example of a Google Earth image imported into a GIS:

[http://spatial-analyst.net/book/node/399]

HTH

T. Hengl
[http://www.wewur.wur.nl/popups/vcard.aspx?id=HENGL001]

PS: As far as I understand, we are not supposed to download data from 
Google's repository.

Op 3-2-2011 16:44, Meesters, Erik schreef:
#
Here is how you can get a single tile

library(dismo)
library(maptools)
library(rgdal)

# get a google map
g <- gmap("Australia")
plot(g)

# overlay boundaries, after projecting to Mercator
data(wrld_simpl)
w = wrld_simpl[wrld_simpl at data[,"NAME"] != "Antarctica", ]
m = spTransform(w, projection(g, asText=F))
plot(m, add=T)

# export to png
filename <- 'oz.png'
png(filename, width=ncol(g), height=nrow(g))
par(mar=c(0,0,0,0))
image(g, col=g at legend@colortable)
dev.off()

# create 'world file' for georferencing png
r <- raster(filename)
extent(r) <- extent(g)
hdr(r, 'worldfile', 'pgw')

# now open the file in ArcMap
#
Erik, it is is actually much simpler:

g <- gmap("Amsterdam, Netherlands", type='satellite', filename="adam.gif")
hdr(g, 'worldfile', 'gfw')

Now open "adam.gif" in ArcMap, but set the projection of the ArcGIS
"data.frame" to Mercator.

Robert