Learn R Programming

geostatsp (version 0.4.4)

GNcities: Retrieve city names and locations

Description

This function is a wrapper for the GNcities function in the geonames package, where the limits can be passed as a bounding box or an Extent.

Usage

GNcities(north,  ...)
	## S3 method for class 'matrix':
GNcities(north,...)
	## S3 method for class 'Extent':
GNcities(north,...)

Arguments

north
A bounding box from a SpatialPoints or SpatialPolygons object or an Extent from a Raster.
...
additional arguments, see GNcities in the geonames package.

Value

  • A SpatialPointsDataFrame

Examples

Run this code
mybbox = rbind(c(5,10),c(45,50))

cities=GNcities(mybbox, max=5)

plot(cities)
text(cities, labels=cities$name, col='red')

Run the code above in your browser using DataLab