Learn R Programming

R2BayesX (version 0.3-1)

read.bnd: Read Geographical Information in Boundary Format

Description

Reads the geographical information provided in a file in boundary format and stores it in a map object.

Usage

read.bnd(file, sorted = FALSE)

Arguments

file
name of the boundary file to be read.
sorted
should the regions be ordered by the numbers speciying the region names (sorted = TRUE)?

Value

  • Returns a list of polygons that form the map. Additional attributes are
  • surroundingParallel list where for each polygon, the name of a possible surrounding region is saved.
  • height2widthRatio between height and width of the map. Allows customised drawing and storage in files by specifying the appropriate height and width.

Details

A boundary file provides the boundary information of a geographical map in terms of closed polygons. For each region of the map, the boundary file contains a block of lines defining the name of the region, the number of lines the polygon consists of, and the polygons themselves. The first line of such a block contains the region code surrounded by quotation marks and the number of lines the polygon of the region consists of. The region code and the number of lines must be separated by a comma. The subsequent lines contain the coordinates of the straight lines that form the boundary of the region. The straight lines are represented by the coordinates of their end points. Coordinates must be separated by a comma. The following is an example of a boundary file as provided in file Germany.bnd in the examples folder of this package. l{ "1001",9 2534.64771,8409.77539 2554.54712,8403.92285 2576.78735,8417.96973 2592.00439,8366.46582 2560.39966,8320.81445 2507.72534,8319.64453 2496.02002,8350.07813 2524.11304,8365.29492 2534.64771,8409.77539 "1002",18 2987.64697,7774.17236 2954.87183,7789.38916 ...} Hence, the region code of the first region is "1001" and contains of 9 points that form its polygon. The second region has region code "1002" and contains of 18 polygon points (note that only the first two points are shown).

References

BayesX Reference Manual. Available at http://www.BayesX.org.

See Also

write.bnd, plotmap, read.gra, write.gra.

Examples

Run this code
file <- file.path(find.package("R2BayesX"), "examples", "Germany.bnd")
germany <- read.bnd(file)
plotmap(germany)

Run the code above in your browser using DataLab