GNcities {mapmisc} | R Documentation |
This function uses the geonames package to provide city names and locations from www.geonames.org.
GNcities(north, east, south, west, lang = "en", maxRows = 10, buffer=0) GNsearch(..., crs=crsLL)
north |
A bounding box or SpatialPoints or SpatialPolygons or Extent or Raster object, or a decimal degree of longitude. |
east,south,west |
If |
lang |
Language for internationalised returned text |
maxRows |
Limit on returned rows |
buffer |
passed to codeextend |
... |
Various search arguments |
crs |
projection for the output |
A SpatialPointsDataFrame with the sampe projection north
if it exists, otherwise in
long-lat.
myraster = raster(matrix(0,10,10),xmn=8,xmx=18,ymn=0,ymx=10, crs=mapmisc::crsLL) values(myraster) = seq(0,1,len=ncell(myraster)) myPoints = SpatialPoints(myraster, proj4string=CRS(proj4string(myraster)))[ seq(1,ncell(myraster),len=5)] ## Not run: if (requireNamespace("geonames", quietly = TRUE)) { cities=GNcities(myPoints, max=5) mytiles = openmap(myraster) map.new(cities) plot(mytiles, add=TRUE) points(cities, col='red') text(cities, labels=cities$name, col='red',pos=4) cities=GNcities(myraster, max=5) map.new(cities) plot(mytiles, add=TRUE) points(cities, col='red') text(cities, labels=cities$name, col='red',pos=4) mapmisc::GNsearch(q="Toronto Ontario") } ## End(Not run)