On Wed, Apr 23, 2014 at 2:42 PM, Agustin Lobo <alobolistas@gmail.com> wrote:

> I think that the output of get_map commands, i.e.
>
> gmap <- get_map(location = rprobextLL@bbox, maptype = "hybrid", source
> = "google",
>     crop = FALSE, zoom = 5)
>
> is a raster (not in the sense of an object of the raster package) in
> gepgraphic coordinates
> (epsg:4326), but actually do not see it specified anywhere. Does
> anyone know for sure?
> The alternative would be google PseudoMercator (eps:3857)
>
> The bounding boxes generally just get passed through to the web service
that is providing the tiles - eg for google maps its getting:

http://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=
2&&maptype=terrain&&&&&&&sensor=false

 - I imagine the web services expect EPSG:4326.


> Also, I'm kind of confused with the get_map help page:
> "Value
> a data.frame with columns latitude, longitude, and fill"
>
> while in R we get:
> > str(gmap)
>  chr [1:1280, 1:1280] "#24392B" "#2E4832" "#3E583B" "#3E583B"
> "#55675F" "#5B6C52" "#656B58" ...
>  - attr(*, "class")= chr [1:2] "ggmap" "raster"
>  - attr(*, "bb")='data.frame':    1 obs. of  4 variables:
>   ..$ ll.lat: num -38.2
>   ..$ ll.lon: num -73.4
>   ..$ ur.lat: num -13.2
>   ..$ ur.lon: num -45.3
>
>
 I think its lying - why not report a documentation bug?

 The returned objects are just matrices of colour values with bb attributes
and class "ggmap" "raster". You can make one yourself easily enough:

 > green = matrix("#00FF00",256,256)
 > attr(green,"bb")=attr(gmap,"bb")
 > class(green)=c("ggmap","raster")

 - taking the bbox from a previous get_map call. Looking at the code the
matrix just comes from readPNG via the png file it dumps in your current
directory (by default). So... if you can work out the WMS call to get a PNG
then you can easily make a ggmap object.

Barry

	[[alternative HTML version deleted]]

