gmap {dismo} | inside-R | A Community Site for R

Retrieve a 'Google Map' that can be used as a background for plotting points and other spatial data. The purpose of using this function should be to display the map in a browser. You should check the Google terms of use http://code.google.com/apis/maps/terms.html to see if your usage of this function (the Google API that creates the maps) is permitted. The projection of the returned Raster object is 'Mercator' (unless you use lonlat=TRUE), and other spatial data may need to be transformed before it can be plotted on top of the Google map. You can use the Mercator function to transform points from longitude/latitude to Mercator. For SpatialLines and SpatialPolygons objects, use spTransform in the rgdal package. This function uses the Google static maps web-service, and is based on functions by Markus Loecher for the RgoogleMaps package. If argument x is a textual locality description, the geocode function is used to retrieve the extent that should be mapped. Change the type to 'roadmap' if the map returned says 'sorry we have no imagery here', or use a larger extent. The returned RasterLayer has a Mercator projection. To plot points (or lines or polygons) on top of it, these need to be transformed first. A matrix of longitude/latitude data can be transformed with the Mercator function used in the example below. 'Spatial*' objects can be transformed with spTransform p <,- spTransform(x, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs') Robert Hijmans and Sebastien Rochette, based on code by Markus Loecher, Sense Networks in the RgoogleMaps package inside-R.org is a collection of resources about the open-source R Project for the R Statistics Community. This site is sponsored by Revolution Analytics. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 22, 2016 @ 8:02 pm