Skip to content
Prev 5800 / 29559 Next

Converting downloaded PNG images using RgoogleMaps to SpatialGridDataFrame class (proj4string?)

Hi all,

Thanks to Markus Loecher and colleagues we can now easily obtain background maps from Google Earth
and use it for plotting/interpretation of spatial data.  

This runs pretty smoothly (e.g. a map of the Netherlands):
# obtain the API key and save into the home folder;
="hybrid")
Read 1 item
[1] "http://maps.google.com/staticmap?center=52.1551723,5.3872035&zoom=7&size=640x640
+   &maptype=hybrid&format=png32&key=****&sensor=true"
trying URL 'http://maps.google.com/staticmap?center=52.1551723,5.3872035&zoom=7&size=640x640
+   &maptype=hybrid&format=png32&key=****=true'
Content type 'image/png' length 703541 bytes (687 Kb)
opened URL
downloaded 687 Kb

netherlands.png has GDAL driver PNG 
and has 640 rows and 640 columns
But how to convert this image into a SpatialGridDataFrame to allow overlays, export to GIS formats
etc?

I am not even sure what the correct proj4string for this image is?
List of 4
 $ : num 52.2
 $ : num 5.39
 $ : num 7
 $ : num [1:640, 1:640] 187 60 66 1 66 202 151 1 214 220 ...
  ..- attr(*, "COL")= chr [1:256] "#88887C" "#887440" "#747838" "#0C1C20" ...
  ..- attr(*, "type")= chr "rgb"
# the coordinates are not embedded!


Thanks,

Tom Hengl
http://home.medewerker.uva.nl/t.hengl/