arc.select: Load dataset to "data.frame"

arc.selectR Documentation

Load dataset to "data.frame"

Description

Load dataset to a standard data frame.

Usage

## S4 method for signature 'arc.table'
arc.select(object, fields, where_clause, selected, sr, ...)


Arguments

object

arc.dataset-class object

fields

string, or list of strings, containing fields to include (default: all)

where_clause

SQL where clause

selected

use only selected records (if any) when dataset is a layer or standalone table

sr

transform geometry to Spatial Reference (default: object@sr)

...

optional additional arguments such as transformation - datum transformation string

Value

arc.select returns a data.frame object (type of arc.data).

Note

If object is arc.feature-class, the "shape" of class arc.shape-class will be attached to the resulting arc.data object.

See Also

arc.data, arc.open, arc.write

Examples


## read all fields
ozone.file <- system.file("extdata", "ca_ozone_pts.shp",
                          package="arcgisbinding")
d <- arc.open(ozone.file)
df <- arc.select(d, names(d@fields))
head(df, n=3)

## read 'name', 'fid' and geometry
df <- arc.select(d, c('fid', 'ozone'), where_clause="fid < 5")
nrow(df)

## transform points to "+proj=eqc"
df <- arc.select(d,"fid", where_clause="fid<5", sr="+proj=eqc")
arc.shape(df)

## datum transformation, from NAD_1983 to WGS_1984
## prepare dataset
x <- c(1455535.149968639, 1446183.62438038, 1447950.6349539757)
y <- c(478067.64943164587, 484500.4190463871, 479746.6336064786)
data_path <- file.path(tempdir(), "data.gdb", "test_datum")
## save as NAD_1983
arc.write(data_path, coords=cbind(x, y), shape_info=list(type="Point", WKID=2893))
## read and transform to WGS_1984
df <- arc.select(arc.open(data_path), sr=4326, transformation='NAD_1983_HARN_To_WGS_1984_2')
x <- arc.shape(df)$x
stopifnot(sprintf('%.8f', x[1]) == '-76.49626388')


R-ArcGIS/r-bridge documentation built on May 3, 2024, 9:47 a.m.