read.bnd: Read Geographical Information in Boundary Format

View source: R/read.bnd.R

read.bndR Documentation

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)?

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.

"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).

Value

Returns a list of polygons that form the map. Additional attributes are

surrounding

Parallel list where for each polygon, the name of a possible surrounding region is saved.

height2width

Ratio between height and width of the map. Allows customised drawing and storage in files by specifying the appropriate height and width.

Author(s)

Daniel Sabanes Bove, Felix Heinzl, Thomas Kneib, Andreas Brezger.

References

BayesX Reference Manual. Available at https://www.uni-goettingen.de/de/bayesx/550513.html.

See Also

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

Examples

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

R2BayesX documentation built on Oct. 20, 2023, 9:11 a.m.