R: Read Geographical Information in Boundary Format
read.bnd
R 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.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(R2BayesX)
Loading required package: BayesXsrc
Loading required package: colorspace
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/R2BayesX/read.bnd.Rd_%03d_medium.png", width=480, height=480)
> ### Name: read.bnd
> ### Title: Read Geographical Information in Boundary Format
> ### Aliases: read.bnd
> ### Keywords: spatial
>
> ### ** Examples
>
> file <- file.path(find.package("R2BayesX"), "examples", "Germany.bnd")
> germany <- read.bnd(file)
Read 8852 records
Note: map consists of 310 polygons
Note: map consists of 309 regions
Reading map ... finished
> plotmap(germany)
>
>
>
>
>
> dev.off()
null device
1
>