CSWClient | R Documentation |
CSWClient
CSWClient
R6Class
object.
Object of R6Class
with methods for interfacing an OGC
Catalogue Service for the Web.
ows4R::OGCAbstractObject
-> ows4R::OWSClient
-> CSWClient
ows4R::OGCAbstractObject$ERROR()
ows4R::OGCAbstractObject$INFO()
ows4R::OGCAbstractObject$WARN()
ows4R::OGCAbstractObject$encode()
ows4R::OGCAbstractObject$getClass()
ows4R::OGCAbstractObject$getClassName()
ows4R::OGCAbstractObject$getNamespaceDefinition()
ows4R::OGCAbstractObject$isFieldInheritedFrom()
ows4R::OGCAbstractObject$logger()
ows4R::OGCAbstractObject$print()
ows4R::OWSClient$getCASUrl()
ows4R::OWSClient$getConfig()
ows4R::OWSClient$getHeaders()
ows4R::OWSClient$getPwd()
ows4R::OWSClient$getToken()
ows4R::OWSClient$getUrl()
ows4R::OWSClient$getUser()
ows4R::OWSClient$getVersion()
new()
This method is used to instantiate a CSWClient with the url
of the
OGC service. Authentication is supported using basic auth (using user
/pwd
arguments),
bearer token (using token
argument), or custom (using headers
argument). By default, the logger
argument will be set to NULL
(no logger). This argument accepts two possible
values: INFO
: to print only ows4R logs, DEBUG
: to print more verbose logs
CSWClient$new( url, serviceVersion = NULL, user = NULL, pwd = NULL, token = NULL, headers = c(), config = httr::config(), cas_url = NULL, logger = NULL )
url
url
serviceVersion
CSW service version
user
user
pwd
password
token
token
headers
headers
config
config
cas_url
Central Authentication Service (CAS) URL
logger
logger
getCapabilities()
Get CSW capabilities
CSWClient$getCapabilities()
an object of class CSWCapabilities
reloadCapabilities()
Reloads CSW capabilities
CSWClient$reloadCapabilities()
describeRecord()
Describe records. Retrieves the XML schema for CSW records. By default, returns the XML schema
for the CSW records (http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the
outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 schema
CSWClient$describeRecord(namespace, ...)
namespace
namespace
...
any other parameter to pass to the CSWDescribeRecord service request
the service record description
getRecordById()
Get a record by Id. By default, the record will be returned following the CSW schema
(http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 records.
The parameter elementSetName
should among values "full", "brief", "summary". The default
"full" corresponds to the full metadata sheet returned. "brief" and "summary" will contain only
a subset of the metadata content.
CSWClient$getRecordById(id, elementSetName = "full", ...)
id
record id
elementSetName
element set name. Default is "full"
...
any other parameter to pass to CSWGetRecordById service request
the fetched record, NULL
otherwise
getRecords()
Get records based on a query, object of class CSWQuery
. The maximum number of records can be
set either for the full query (maxRecords
) or per request (maxRecordsPerRequest
, default set to 10 records)
considering this operation is paginated. By default, the record will be returned following the CSW schema
(http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 records.
CSWClient$getRecords( query = CSWQuery$new(), maxRecords = NULL, maxRecordsPerRequest = 10L, ... )
query
an object of class CSWQuery. By default, an empty query is set.
maxRecords
max number of total records. Default is NULL
meaning all records are returned.
maxRecordsPerRequest
max number of records to return per request. Default set to 10.
...
any other parameter to be passed to CSWGetRecords service request
the list of records. By default each record will be returned as Dublin Core list
object. In case
ISO 19115/19139 is set as outputSchema
, each record will be object of class ISOMetadata
from
geometa.
transaction()
Generic transaction method. Used for inserting, updating or deleting metadata using the transactional CSW service.
The type
gives the type of transaction (Insert, Update, or Delete). The record
CSWClient$transaction( type, record = NULL, recordProperty = NULL, constraint = NULL, ... )
type
of transaction either "Insert", "Update" or "Delete"
record
the record subject of the transaction
recordProperty
record property, object of class CSWRecordProperty
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to CSWTransaction service request
TRUE
if transaction succeeded, FALSE
otherwise
insertRecord()
Inserts a new record
CSWClient$insertRecord(record, ...)
record
record subject of the Insertion
...
any other parameter to pass to the transaction
TRUE
if insertion succeeded, FALSE
otherwise
updateRecord()
Updates an existing record
CSWClient$updateRecord( record = NULL, recordProperty = NULL, constraint = NULL, ... )
record
record subject of the Insertion
recordProperty
record property, object of class CSWRecordProperty
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to the transaction
TRUE
if update succeeded, FALSE
otherwise
deleteRecord()
Deletes an existing (set of) record(s). A constraint (object of class CSWConstraint
)
can be specified to limit the deletion to some records.
CSWClient$deleteRecord(record = NULL, constraint = NULL, ...)
record
record subject of the Insertion
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to the transaction
TRUE
if deletion succeeded, FALSE
otherwise
deleteRecordById()
Deletes an existing record by identifier (constraint used to identify the record based on its identifier).
CSWClient$deleteRecordById(id)
id
record id
TRUE
if deletion succeeded, FALSE
otherwise
harvestRecord()
Harvests a single record from a sourceUrl
, given a resourceType
(by default "http://www.isotc211.org/2005/gmd").
CSWClient$harvestRecord( sourceUrl, resourceType = "http://www.isotc211.org/2005/gmd" )
sourceUrl
source URL
resourceType
resource type. Default is "http://www.isotc211.org/2005/gmd"
TRUE
if harvesting succeeded, FALSE
otherwise
harvestNode()
Harvests a CSW node (having its endpoint defined by an url
). A query
(object of class CSWQuery
) can be
specificed if needed to restrain the harvesting to a subset. The resourceType
defines the type of resources to be harvested
(by default "http://www.isotc211.org/2005/gmd")
CSWClient$harvestNode( url, query = CSWQuery$new(), resourceType = "http://www.isotc211.org/2005/gmd", sourceBaseUrl )
url
CSW node URL
query
a CSW query, object of class CSWQuery
resourceType
resource type. Default is "http://www.isotc211.org/2005/gmd"
sourceBaseUrl
source base URL
an object of class list
giving the number of records found
and those actually harvested
clone()
The objects of this class are cloneable with this method.
CSWClient$clone(deep = FALSE)
deep
Whether to make a deep clone.
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
## Not run:
#example based on CSW endpoint responding at http://localhost:8000/csw
csw <- CSWClient$new("http://localhost:8000/csw", serviceVersion = "2.0.2")
#get capabilities
caps <- csw$getCapabilities()
#get records
records <- csw$getRecords()
#get record by id
record <- csw$getRecordById("my-metadata-id")
#Advanced examples at https://github.com/eblondel/ows4R/wiki#csw
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.