Import all docs from an iDAI.field / Field Desktop project
Source:R/get_idaifield_docs.R
get_idaifield_docs.RdImports all docs from an iDAI.Field-database that is currently running and syncing into a list-object for further processing in R. The function is only useful for the import from iDAI.field 2 or Field Desktop with the respective client running on the same computer or in the same network as the R-script.
Usage
get_idaifield_docs(
connection = connect_idaifield(serverip = "127.0.0.1", project = "rtest", user = "R",
pwd = "hallo"),
raw = TRUE,
json = FALSE,
projectname = NULL
)Arguments
- connection
A connection object as returned by
connect_idaifield()- raw
TRUE/FALSE. Should the result already be unnested to resource level using
check_and_unnest()? (Default is FALSE.)- json
TRUE/FALSE. Should the function return a JSON-character string? (Default is FALSE.) If TRUE output cannot be processed with the functions from this package. Can be parsed using e.g.
jsonlite::fromJSON().- projectname
(deprecated) The name of the project in the Field Client that one wishes to load. Will overwrite the project set in the
connection-object. Seeidf_projects()for all available projects.
Value
an object (list) of class idaifield_docs if raw = TRUE and
idaifield_resources if raw = FALSE that contains all docs/resources
in the selected project except for the project configuration.
The connection and projectname are attached as attributes for
later use. (If json = TRUE, returns a character string in JSON-format.)
Details
When using raw = TRUE (the default) this function will allow
you to get the change log for each resource, i.e. which user changed
something in the resource at what time and who created it.
Setting raw = FALSE will only return a list of the actual data.
You can do this at a later time using check_and_unnest()
from this package.
NOTE: If you are planning on using the coordinates stored in the database,
I strongly suggest you consider changing your R digits-setting to a higher
value than the default. Depending on the projection used, coordinates may
be represented by rather long numbers which R might automatically round on
import. options(digits = 20) should more than do the trick. (That applies
to other fields containing long numbers as well.)
See also
For querying the database:
idf_query(),idf_index_query(),idf_json_query()For filtering / selecting an
idaifield_docs- oridaifield_resources-list:idf_select_by()For processing the list:
check_and_unnest(),simplify_idaifield()
Examples
if (FALSE) { # \dontrun{
conn <- connect_idaifield(project = "rtest", pwd = "hallo")
idaifield_docs <- get_idaifield_docs(connection = conn)
} # }