The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
R Interface to GeoNode REST API – Allows to perform programmatically from R
geonode4R
is a new package to perform operations of the GeoNode REST API. It supports CRUD operations (Create, Read, Update, Delete) and search on GeoNode resources.
If you wish to sponsor geonode4R, do not hesitate to contact me
Many thanks to the following organizations that have provided fundings for developing the geonode4R
package:
Table of contents
1. Overview
2. Package status
3. Credits
4. User guide
4.1 Installation
4.2 Connect to GeoNode REST API
4.3 Create a resource
4.4 Read a resource
4.5 Delete a resource
5. Issue reporting
Until now, equivalent tools were existing for other programming languages (e.g. Java, Python) but not in R. geonode4R intends to provide R native interface to the GeoNode REST API, in order to facilitate publication of geographic data resources from R to GeoNode.
A first version is being published to CRAN.
The package is at its early stage. It aims to be consolidated together with improvements made on the GeoNode API, and based on feedback of the user community.
© 2022, Emmanuel Blondel
Package distributed under MIT license.
If you use geonode4R
, i would be very grateful if you can add a citation in your published work. By citing geonode4R
, beyond acknowledging the work, you contribute to make it more visible and guarantee its growing and sustainability. You can get the preferred citation by running citation("geonode4R)
in R.
You can reference geonode4R
through its DOI:
For now, the package can be installed from Github
install.packages("remotes")
Once the devtools package loaded, you can use the install_github to install geonode4R
By default, package will be installed from master
which is the current version in development (likely to be unstable).
remotes::install_github("eblondel/geonode4R")
The main entry point of geosapi
is the `GeoNodeManager. To configure it, enter the following line, specifying the base
URL`` of your GeoNode, and your credentials:
geonode <- GeoNodeManager$new(
url = "http://localhost:8080/geonode", #baseUrl of the Geoserver
user = "admin", pwd = "password", #credentials
logger = NULL #logger, for info or debugging purpose
)
By default, the geonode4R
logger is deactivated. To enable the logger, specify the level of log you wish as parameter of the above R code. Two logging levels are available:
INFO
: will print the geonode4R
logs. Three types of messages can be distinguished: INFO
, WARN
, ERROR
. The latter is generally associated with a stop
and indicate an blocking error for the R method executed.DEBUG
will print the above geonode4R
logs, and report all logs from HTTP requests performed with cURL
The GeoNodeManager
inherits all methods of resource dependent managers, to provide the users with a single R interface to GeoNode REST API operations.
To upload a shapefile or another resource, list the resource files (e.g. a list of ESRI Shapefiles), and use the upload
method of the GeoNodeManager
.
files = list.files(system.file("extdata/samples", package = "geonode4R"), pattern = "shapefile1", full.names = T)
files = files[!endsWith(files, ".zip")]
created = GEONODE$upload(files)
To get a resource, you can get it based on a dataset identifier (‘pk’), or get it by UUID or alternate dataset. The below examples show how to perform these tasks.
#getResource
resource = GEONODE$getResource(created$dataset)
#getResourceByUUID
resource_by_uuid = GEONODE$getResourceByUUID(resource$uuid)
#getResourceByAlternate
resource_by_alternate = GEONODE$getResourceByAlternate("shapefile1")
To delete a resource, use the deleteResource
method of the GeoNodeManager
:
deleted = GEONODE$deleteResource(created$dataset)
Issues can be reported at https://github.com/eblondel/geonode4R/issues
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.