vicspatial
An R package to easily utilise Victorian Government spatial datasets
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: joss.theoj.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.1%) to scientific vocabulary
Keywords
gis
r
spatial-data
wfs
wfs-urls
Last synced: 6 months ago
·
JSON representation
Repository
An R package to easily utilise Victorian Government spatial datasets
Basic Info
- Host: GitHub
- Owner: JustinCally
- License: apache-2.0
- Language: R
- Default Branch: master
- Homepage: https://justincally.github.io/vicspatial
- Size: 13.9 MB
Statistics
- Stars: 16
- Watchers: 4
- Forks: 6
- Open Issues: 5
- Releases: 7
Topics
gis
r
spatial-data
wfs
wfs-urls
Created over 5 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# vicspatial
[](https://app.codecov.io/gh/JustinCally/vicspatial?branch=master)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://CRAN.R-project.org/package=vicspatial)
[](https://cran.r-project.org/package=vicspatial)
[](https://github.com/JustinCally/vicspatial/actions/workflows/R-CMD-check.yaml)
**In May 2025 (version 0.3.0) `VicmapR` was renamed to `vicspatial`. Unfortunately this change has been requested by the trademark holders of `VICMAP` (Department of Transport and Planning). While redirections should be in place for GitHub and CRAN websites, please check existing code for explicit mentions of `VicmapR`.**
The goal of vicspatial is to provide functions to easily access Victorian Government spatial data through their WFS (Web Feature Service). vicspatial leverages code and a lazy querying approach developed by [Teucher et al. (2021)](https://joss.theoj.org/papers/10.21105/joss.02927) for the [{bcdata} R package](https://bcgov.github.io/bcdata/), which allows for a responsive and precise querying process.
## Migration of Victoria's Open Data Geoserver
**From March 2023 (`vicspatial v0.2.0`) the way `vicspatial` obtains data has changed**
In March 2023 the data platform used by `vicspatial` will be migrated with the legacy platform discontinued. Changes have been to the `vicspatial` package to allow for the conversion and translation of of code in an effort to ensure legacy code still works. However, the migration may have unseen consequences and users are encouraged to review code.
## Installation
You can install the released version from CRAN with:
``` r
install.packages("vicspatial")
```
Or you can install the the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("JustinCally/vicspatial")
```
### Dependencies
Currently, the ability to use accurate geometric filters using `vicspatial` requires GDAL > 3.0. To see how to upgrade your version of GDAL and link it to the `sf` package visit: https://r-spatial.github.io/sf/#installing
```{r dependencies}
library(sf)
sf::sf_extSoftVersion()
```
## Example
### Searching for data
```{r example}
library(vicspatial)
# Check to see if the geoserver is working. It will error if it is not working
check_geoserver()
listLayers(pattern = "watercourse", ignore.case = T)
```
### Reading in data
As of vicspatial version `0.1.0` data is read in using a lazy evaluation method with the convenience of pipe operators (`%>%`). A lot of the methods and code have already been written for a similar package ([bcdata](https://github.com/bcgov/bcdata)) that downloads data from the British Columbia WFS catalogues. Using a similar approach, vicspatial allows users to construct a WFS query in a step-wise format. In doing so a query is reserved until `collect()` is used on the `vicmap_promise`. The example below shows an extensive example of how the to easily read in spatial data:
```{r query_example}
# Read in an example shape to restrict our query to using geometric filtering
melbourne <- sf::st_read(system.file("shapes/melbourne.geojson", package="vicspatial"), quiet = T)
# Obtain a promise of what data will be returned for a given layer
vicmap_query(layer = "open-data-platform:hy_watercourse")
# Build a more specific query and collect the results
vicmap_query(layer = "open-data-platform:hy_watercourse") %>% # layer to query
filter(hierarchy == "L" & feature_type_code == 'watercourse_channel_drain') %>% # simple filter for a column
filter(INTERSECTS(melbourne)) %>% # more advanced geometric filter
select(hierarchy, pfi) %>%
collect()
```
vicspatial translates numerous geometric filter functions available in the Victorian Government's WFS Geoserver supports numerous [geometric filters](https://docs.geoserver.org/stable/en/user/tutorials/cql/cql_tutorial.html#geometric-filters):
+ `EQUALS`
+ `DISJOINT`
+ `INTERSECTS`
+ `TOUCHES`
+ `CROSSES`
+ `WITHIN`
+ `CONTAINS`
+ `OVERLAPS`
+ `DWITHIN`
+ `BEYOND`
+ `BBOX`
These filters can be used within the `filter()` function by providing them an object of class `sf/sfc/sfg/bbox` as shown above with the `melbourne` object.
### Using other WFS urls
Using `options(vicmap.base_url)` vicspatial can query data from other WFS services; while this remains somewhat untested it is relatively easy to point vicspatial to another WFS url. This option would need to be set every session to override the base vicspatial url. For instance, the BOM WFS can be used as follows:
```{r, eval=FALSE}
# set the new base url
options(vicmap.base_url = "http://geofabric.bom.gov.au/simplefeatures/ahgf_shcatch/wfs")
# collect a data sample
catchments <- vicmap_query("ahgf_shcatch:AHGFCatchment") %>%
head(10) %>%
collect()
```
*__Note__: Using other Geoserver WFS urls will not necessarily work as expected due to the potential differences in the capabilities of the Geoserver instance*
### License
Copyright 2018 Province of British Columbia
Modifications Copyright 2020 Justin Cally
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Owner
- Name: Justin Cally
- Login: JustinCally
- Kind: user
- Location: Melbourne
- Company: EPA Victoria
- Twitter: Jcal1
- Repositories: 3
- Profile: https://github.com/JustinCally
GitHub Events
Total
- Push event: 4
Last Year
- Push event: 4
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 39
- Total pull requests: 28
- Average time to close issues: about 2 months
- Average time to close pull requests: 14 days
- Total issue authors: 3
- Total pull request authors: 5
- Average comments per issue: 0.38
- Average comments per pull request: 0.39
- Merged pull requests: 25
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: 1 day
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- JustinCally (35)
- rachelannieswain (1)
Pull Request Authors
- JustinCally (22)
- rachelannieswain (2)
- adam-gruer (2)
- mgirlich (1)
- stephhazlitt (1)
Top Labels
Issue Labels
enhancement (6)
bug (4)
migration (3)
documentation (3)
test (1)
Pull Request Labels
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- DBI * imports
- cli * imports
- curl * imports
- dbplyr >= 2.2.0 imports
- dplyr * imports
- glue * imports
- httr * imports
- kableExtra * imports
- knitr * imports
- leaflet * imports
- lubridate * imports
- magrittr * imports
- mapview * imports
- methods * imports
- purrr * imports
- rlang * imports
- rvest * imports
- sf >= 0.7 imports
- xml2 * imports
- covr * suggests
- rmarkdown * suggests
- testthat >= 2.1.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite