ExtractFromXIF {IFC} | R Documentation |
RIF/CIF File Reader
Description
Extracts data from RIF or CIF Files.
Usage
ExtractFromXIF(
fileName,
extract_features = TRUE,
extract_images = FALSE,
extract_offsets = FALSE,
extract_stats = TRUE,
pnt_in_poly_algorithm = 1,
pnt_in_poly_epsilon = 1e-12,
force_default = TRUE,
verbose = FALSE,
verbosity = 1,
display_progress = TRUE,
fast = TRUE,
recursive = FALSE,
...
)
Arguments
fileName |
path to file. |
extract_features |
whether to extract features from file. Default is TRUE. |
extract_images |
whether to extract images information from file. Default is FALSE. |
extract_offsets |
whether to extract IFDs offsets from corresponding. Default is FALSE. |
extract_stats |
whether to extract population statistics. Default is TRUE. |
pnt_in_poly_algorithm |
algorithm used to determine if object belongs to a polygon region or not. Default is 1. |
pnt_in_poly_epsilon |
epsilon to determine if object belongs to a polygon region or not. It only applies when algorithm is 1. Default is 1e-12. |
force_default |
when display information can't be retrieved whether to use default values. Default is TRUE. |
verbose |
whether to display information (use for debugging purpose). Default is FALSE. |
verbosity |
quantity of information displayed when verbose is TRUE; 1: normal, 2: rich. Default is 1. |
display_progress |
whether to display a progress bar. Default is TRUE. |
fast |
whether to fast extract 'objects' or not. Default is TRUE. |
recursive |
whether to recursively apply |
... |
Other arguments to be passed. |
Details
If extract_stats is TRUE, extract_features will be automatically forced to TRUE.
If extract_images is TRUE, extract_offsets will be automatically forced to TRUE.
If extract_offsets is TRUE, offsets of images and masks IFDs will be extracted.
If extract_images is TRUE, information about images will be extracted.
If the input fileName is a merged of several files and recursive is set to TRUE, then ExtractFromXIF will be applied recursively on these files.
/!\ Note that features extraction is mandatory to correctly extract graphs, pops, regions and statistics values.
Value
A named list of class 'IFC_data', whose members are:
-description, a list of descriptive information,
-fileName, path of fileName input,
-fileName_image, same as fileName,
-features, a data.frame of features,
-features_def, a describing how features are defined,
-graphs, a list of graphical elements found,
-pops, a list describing populations found,
-regions, a list describing how regions are defined,
-images, a data.frame describing information about images,
-offsets, an integer vector of images and masks IFDs offsets,
-stats, a data.frame describing populations count and percentage to parent and total population,
-checksum, current file checksum.
If fileName is a merged of several files returned object will be of class 'IFC_data' and 'Merged'.
If recursive is set to "TRUE", ExtractFromXIF will be applied recursively on files defining the merged.
and the returned object will be a list of the above-mentionned list for each of these files.
Source
For pnt_in_poly_algorithm, Trigonometry, is an adaptation of Jeremy VanDerWal's code https://github.com/jjvanderwal/SDMTools
Examples
if(requireNamespace("IFCdata", quietly = TRUE)) {
## use a cif file, but you can also read rif
file_cif <- system.file("extdata", "example.cif", package = "IFCdata")
cif <- ExtractFromXIF(fileName = file_cif)
} else {
message(sprintf('Please run `install.packages("IFCdata", repos = "%s", type = "source")` %s',
'https://gitdemont.github.io/IFCdata/',
'to install extra files required to run this example.'))
}