Add Cities to Existing Map
map.cities.RdAdds city locations and (optionally) names to an existing map using a specified database.
Usage
map.cities(x = world.cities, country = "", label = NULL, minpop = 0,
maxpop = Inf, capitals = 0, cex = par("cex"), projection = FALSE,
parameters = NULL, orientation = NULL, pch = 1, ...)Arguments
- x
Name of database. See
world.citiesto determine the structure of the database. WARNING: should you use this function to plot another set of data points, keep in mind that points on a map can nowadays be localised upto extreme detail with specialized software (a dot on a national map can reveal someones home address), so beware not to reveal private data in some way.- country
If the string country is specified, limit the displayed cities to be from within the specified country, province or state (depending on how the database has been constructed).
- label
If
TRUE, label all cities. IfNULL, the cities will be labelled unless there are 20 or more.- minpop
The minimum value of population below which a particular city will not be shown.
- maxpop
The maximum value of population above which a particular city will not be shown.
- capitals
Selection of capitals-only display. Capitals may be 1 (country capital), 2 (provincial, state, or regional capital) or 3 (local capital). See
world.citiesfor further information.- cex
The value of cex acts to override the current value of character size expansion.
- projection
Boolean or character value. If
FALSE(the default), no projection is assumed, ifTRUE, the previous projection is used, otherwise a character string that names a map projection to use. Seemapproject(in themapprojlibrary).- parameters
numeric vector of parameters for use with the
projectionargument. This argument is optional only in the sense that certain projections do not require additional parameters. If a projection does require additional parameters, these must be given in theparametersargument.- orientation
a vector
c(latitude, longitude, rotation)describing where the map should be centered and a clockwise rotation (in degrees) about this center.- pch
plotting character to use for marking city location. See
pointsfor options.- ...
Further plotting parameters may be specified as for the commands
pointsandtext.
Side Effects
All cities within the boundaries of the plot containing the current map are added to the plot. Note that it is possible that the boundaries of the plot exceed the boundaries of the map requested, and so more cities than were expected might be shown.
Details
The database is searched for all cities matching the specified criteria and fitting within the limits of the plot currently displayed. The default database is of all cities that have a population greater than a certain threshold or which are capital cities of a country or island territory. The threshold varies from country to country, but in general is no higher than about 40,000. The data were originally obtained from Stefan Helders' website (http://www.world-gazetteer.com), which no longer exists. There are no recent updates available.
There are three supplied databases, world.cities (the default), us.cities
and canada.cities. The latter two, which need to be made available by
using a 'data()' call, include the state or province name with the
city name (thanks to John Woodruff jpwoodruff@irisinternet.net
for the state and province information).
Note that if the underlying map is "Pacific-centric", i.e. longitudes exceed 180 degrees, and a projection is used, then the map.cities data must be transformed appropriately.