Re: [R-sig-Geo] RgoogleMaps

2011-03-16 Thread Agustin Diez Castillo
Following on  that I wish to download several single tiles. To do it I declare 
the tile extension I wish to download and adapting Robert's hint  I do the 
following
library(dismo)
#I need to load XML as well
library(XML)
library(maptools)
library(rgdal)
#declare the extent
e = extent(36.1195,36.1205,5.8725,5.8735)
#got the map, exp less than 1.0 zooms the result
r <- gmap(e, type="satellite", filename="mypath/mynumbered.gif", exp=1.0)
#check the result
plot(r)

The thing is that now I want to download several tiles getting the extent from 
a table that looks like that
   xmin xmax ymin ymax num
1  36.09940 36.10340 5.671173 5.675173  10
2  36.19274 36.19674 5.665194 5.669194  15
3  36.17748 36.18148 5.820774 5.824774  19
4  36.19274 36.19674 5.665194 5.669194  43
5  36.09940 36.10340 5.671173 5.675173  44
6  36.17748 36.18148 5.820774 5.824774  46
so I want pass values from the table to 'extent' and get and numbered gif for 
each.
Any ideas?
Cheers
Agustin
sessionInfo
R version 2.11.1 Patched (2010-08-26 r52824)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US/en_US/en_US/C/en_US/en_US

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

other attached packages:
 [1] maps_2.1-4  gpclib_1.5-1maptools_0.7-38 lattice_0.18-8  
foreign_0.8-40  XML_3.2-0   dismo_0.5-11rJava_0.8-8 raster_1.7-29  
[10] rgdal_0.6-28sp_0.9-76  

loaded via a namespace (and not attached):
[1] grid_2.11.1  tools_2.11.1



On Feb 3, 2011, at 9:12 PM, Robert Hijmans wrote:

> 
>> Dear all, 
>> I'm using the package RgoogleMaps to import google earth maps into R. The
>> object that is retrieved with function GetMap contains a number of slots
>> which I think can be used to translate the google picture into a geoTiff
>> to for example import into ArgGis. 
>> If anyone would have an example of how to accomplish that or what function
>> to use, I'd be very greatful. 
>> Best wishes, 
>> Erik Meesters 
>> 
> 
> 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@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@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
> 
> -- 
> View this message in context: 
> http://r-sig-geo.2731867.n2.nabble.com/RgoogleMaps-tp5989261p5990287.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> 
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] RgoogleMaps

2011-02-03 Thread Robert Hijmans

> Dear all, 
> I'm using the package RgoogleMaps to import google earth maps into R. The
> object that is retrieved with function GetMap contains a number of slots
> which I think can be used to translate the google picture into a geoTiff
> to for example import into ArgGis. 
> If anyone would have an example of how to accomplish that or what function
> to use, I'd be very greatful. 
> Best wishes, 
> Erik Meesters 
> 

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
-- 
View this message in context: 
http://r-sig-geo.2731867.n2.nabble.com/RgoogleMaps-tp5989261p5990349.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] RgoogleMaps

2011-02-03 Thread Robert Hijmans

> Dear all, 
> I'm using the package RgoogleMaps to import google earth maps into R. The
> object that is retrieved with function GetMap contains a number of slots
> which I think can be used to translate the google picture into a geoTiff
> to for example import into ArgGis. 
> If anyone would have an example of how to accomplish that or what function
> to use, I'd be very greatful. 
> Best wishes, 
> Erik Meesters 
> 

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@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@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

-- 
View this message in context: 
http://r-sig-geo.2731867.n2.nabble.com/RgoogleMaps-tp5989261p5990287.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] RgoogleMaps

2011-02-03 Thread Tomislav Hengl


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:

Dear all,
I'm using the package RgoogleMaps to import google earth maps into R. The 
object that is retrieved with function GetMap contains a number of slots which 
I think can be used to translate the google picture into a geoTiff to for 
example import into ArgGis.
If anyone would have an example of how to accomplish that or what function to 
use, I'd be very greatful.
Best wishes,
Erik Meesters

Researcher
Wageningen IMARES
Dept. Ecosystems
The Netherlands

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo