bleiglas
bleiglas: An R package for interpolation and visualisation of spatiotemporal data with 3D tessellation - Published in JOSS (2021)
Science Score: 95.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 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Keywords from Contributors
Scientific Fields
Repository
R Package - Spatiotemporal Data Interpolation and Visualisation based on 3D Tessellation
Basic Info
Statistics
- Stars: 14
- Watchers: 4
- Forks: 1
- Open Issues: 1
- Releases: 1
Topics
Metadata Files
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
always_allow_html: true
---
[](https://www.repostatus.org/#inactive)

[](https://github.com/nevrome/bleiglas/actions/workflows/check-release.yaml)
[](https://codecov.io/github/nevrome/bleiglas?branch=master)
[](https://www.r-project.org/Licenses/MIT)
[](https://doi.org/10.21105/joss.03092)
```{r setup, echo = FALSE}
library(magrittr)
library(knitr)
library(rgl)
library(ggplot2)
knit_hooks$set(webgl = hook_rgl)
view_matrix <- structure(c(0.586383819580078, 0.356217533349991, -0.727502763271332,
0, -0.810031354427338, 0.257360488176346, -0.526888787746429,
0, -0.000456457957625389, 0.898260772228241, 0.439460128545761,
0, 0, 0, 0, 1), .Dim = c(4L, 4L))
```
# bleiglas
bleiglas is an R package that employs [Voro++](http://math.lbl.gov/voro++/) for the calculation of three dimensional Voronoi diagrams from input point clouds. This is a special form of tessellation where each polygon is defined as the area closest to one particular seed point. Voronoi diagrams have useful applications in - among others - astronomy, material science or geography and bleiglas provides functions to make 3D tessellation more readily available as a mean for data visualisation and interpolation. It can be used for any 3D point cloud, but the output is optimized for spatiotemporal applications in archaeology.
1. This README (see Quickstart guide below) describes a basic workflow with code and explains some of my thought process when writing this package.
2. A [JOSS paper](https://doi.org/10.21105/joss.03092) gives some background, introduces the core functions from a more technical point of view and presents an example application.
3. A (rather technical) vignette presents all the code necessary to reproduce the "real world" example application in said JOSS paper. When bleiglas is installed you can open the vignette in R with `vignette("bleiglas_case_study")`.
If you have questions beyond this documentation feel free to open an [issue](https://github.com/nevrome/bleiglas/issues) here on Github. Please also see our [contributing guide](CONTRIBUTING.md).
## Installation
You can install bleiglas from github
```{r, eval=FALSE}
if(!require('remotes')) install.packages('remotes')
remotes::install_github("nevrome/bleiglas", build_vignettes = TRUE)
```
For the main function `tessellate` you also have to [install the Voro++ software](http://math.lbl.gov/voro++/download/). The package is already available in all major Linux software repositories (on Debian/Ubuntu you can simply run `sudo apt-get install voro++`.). MacOS users should be able to install it via homebrew (`brew install voro++`).
## Quickstart
For this quickstart, we assume you have packages `tidyverse`, `sf`, `rgeos` (which in turn requires the Unix package `geos`) and `c14bazAAR` installed.
#### Getting some data
I decided to use Dirk Seidenstickers [*Archives des datations radiocarbone d'Afrique centrale*](https://github.com/dirkseidensticker/aDRAC) dataset for this purpose. It includes radiocarbon datings from Central Africa that combine spatial (x & y) and temporal (z) position with some meta information.
Click here for the data preparation steps
I selected dates from Cameroon between 1000 and 3000 uncalibrated BP and projected them into a worldwide cylindrical reference system (epsg [4088](https://epsg.io/4088)). As Cameroon is close to the equator this projection should represent distances, angles and areas sufficiently correct for this example exercise. As a minor pre-processing step, I here also remove samples with equal position in all three dimensions for the tessellation.
```{r, message=FALSE}
# download raw data with the data access package c14bazAAR
# c14bazAAR can be installed with
# install.packages("c14bazAAR", repos = c(ropensci = "https://ropensci.r-universe.dev"))
c14_cmr <- c14bazAAR::get_c14data("adrac") %>%
# filter data
dplyr::filter(!is.na(lat) & !is.na(lon), c14age > 1000, c14age < 3000, country == "CMR")
# remove doubles
c14_cmr_unique <- c14_cmr %>%
dplyr::mutate(
rounded_coords_lat = round(lat, 3),
rounded_coords_lon = round(lon, 3)
) %>%
dplyr::group_by(rounded_coords_lat, rounded_coords_lon, c14age) %>%
dplyr::filter(dplyr::row_number() == 1) %>%
dplyr::ungroup()
# transform coordinates
coords <- data.frame(c14_cmr_unique$lon, c14_cmr_unique$lat) %>%
sf::st_as_sf(coords = c(1, 2), crs = 4326) %>%
sf::st_transform(crs = 4088) %>%
sf::st_coordinates()
# create active dataset
c14 <- c14_cmr_unique %>%
dplyr::transmute(
id = seq_len(nrow(.)),
x = coords[,1],
y = coords[,2],
z = c14age,
period = period
)
```
Data: c14
```{r}
c14
```
#### 3D tessellation
[Tessellation](https://en.wikipedia.org/wiki/Tessellation) means filling space with polygons so that neither gaps nor overlaps occur. This is an exciting application for art (e.g. textile art or architecture) and an interesting challenge for mathematics. As a computational archaeologist I was already aware of one particular tessellation algorithm that has quite some relevance for geostatistical analysis like spatial interpolation: Voronoi tilings that are created with [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation). These are tessellations where each polygon covers the space closest to one of a set of sample points.
|
|
|
|
|---|---|---|
Data: polygon_edges
```{r, echo=FALSE} polygon_edges ```
We can plot these polygon edges (black) together with the input sample points (red) in 3D.
```{r, webgl=TRUE, fig.width=10, fig.align="center", eval=FALSE} rgl::axes3d() rgl::points3d(c14$x, c14$y, c14$z, color = "red") rgl::aspect3d(1, 1, 1) rgl::segments3d( x = as.vector(t(polygon_edges[,c(1,4)])), y = as.vector(t(polygon_edges[,c(2,5)])), z = as.vector(t(polygon_edges[,c(3,6)])) ) rgl::view3d(userMatrix = view_matrix, zoom = 0.9) ```
Data: cut_surfaces
```{r, echo=FALSE} cut_surfaces ```
With this data we can plot a matrix of maps that show the cut surfaces.
```{r, fig.width=8, fig.align="center", eval=FALSE} cut_surfaces %>% ggplot() + geom_sf( aes(fill = z), color = "white", lwd = 0.2 ) + geom_sf_text(aes(label = id)) + facet_wrap(~z) + theme( axis.text = element_blank(), axis.ticks = element_blank() ) ```
As all input dates come from Cameroon it makes sense to cut the polygon surfaces to the outline of this administrative unit.
```{r, warning=FALSE} cameroon_border <- rnaturalearth::ne_countries(scale = "medium", returnclass = "sf") %>% dplyr::filter(name == "Cameroon") %>% sf::st_transform(4088) cut_surfaces_cropped <- cut_surfaces %>% sf::st_intersection(cameroon_border) ``` ```{r, fig.width=8, fig.align="center", eval=FALSE} cut_surfaces_cropped %>% ggplot() + geom_sf( aes(fill = z), color = "white", lwd = 0.2 ) + facet_wrap(~z) + theme( axis.text = element_blank(), axis.ticks = element_blank() ) ```
Finally, we can also visualise any point-wise information in our input data as a feature of the tessellation polygons.
```{r, warning=FALSE} cut_surfaces_material <- cut_surfaces_cropped %>% dplyr::left_join( c14, by = "id" ) ``` ```{r, fig.width=8, fig.align="center", eval=FALSE} cut_surfaces_material %>% ggplot() + geom_sf( aes(fill = period), color = "white", lwd = 0.2 ) + facet_wrap(~z.x) + theme( axis.text = element_blank(), axis.ticks = element_blank() ) ```
Owner
- Name: Clemens Schmid
- Login: nevrome
- Kind: user
- Location: Leipzig (Germany)
- Company: MPI GEOANTH / MPI EVA
- Website: https://nevrome.de
- Repositories: 14
- Profile: https://github.com/nevrome
Computational archaeologist and PhD student at MPI GEOANTH / MPI EVA
JOSS Publication
bleiglas: An R package for interpolation and visualisation of spatiotemporal data with 3D tessellation
Authors
Tags
3D data analysis Tessellation Voronoi diagrams Spatiotemporal analysis ArchaeologyCodeMeta (codemeta.json)
{
"@context": [
"https://doi.org/10.5063/schema/codemeta-2.0",
"http://schema.org"
],
"@type": "SoftwareSourceCode",
"identifier": "bleiglas",
"description": "Employs Voro++ for the calculation of three dimensional Voronoi diagrams from\n input point clouds. This is a special form of tessellation where each polygon is defined \n as the area closest to one particular seed point. Voronoi diagrams have useful applications\n in - among others - astronomy, material science or geography and bleiglas provides functions \n to make 3D tessellation more readily available as a mean for data visualisation and interpolation.\n It can be used for any 3D point cloud, but the output is optimized for spatiotemporal applications \n in archaeology.",
"name": "bleiglas: Spatiotemporal Data Interpolation and Visualisation based on 3D Tessellation",
"codeRepository": "https://github.com/nevrome/bleiglas",
"issueTracker": "https://github.com/nevrome/bleiglas/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "1.0.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.1.1 (2021-08-10)",
"author": [
{
"@type": "Person",
"givenName": "Clemens",
"familyName": "Schmid",
"email": "clemens@nevrome.de",
"@id": "https://orcid.org/0000-0003-3448-5715"
}
],
"contributor": [
{
"@type": "Person",
"givenName": "Stephan",
"familyName": "Schiffels",
"@id": "https://orcid.org/0000-0002-1017-9150"
}
],
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Clemens",
"familyName": "Schmid",
"email": "clemens@nevrome.de",
"@id": "https://orcid.org/0000-0003-3448-5715"
}
],
"funder": {},
"maintainer": [
{
"@type": "Person",
"givenName": "Clemens",
"familyName": "Schmid",
"email": "clemens@nevrome.de",
"@id": "https://orcid.org/0000-0003-3448-5715"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "pbapply",
"name": "pbapply",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=pbapply"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "sf",
"name": "sf",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sf"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 3.5.0"
},
{
"@type": "SoftwareApplication",
"identifier": "checkmate",
"name": "checkmate",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=checkmate"
},
{
"@type": "SoftwareApplication",
"identifier": "data.table",
"name": "data.table",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=data.table"
},
{
"@type": "SoftwareApplication",
"identifier": "Rcpp",
"name": "Rcpp",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=Rcpp"
}
],
"readme": "https://github.com/nevrome/bleiglas/blob/master/README.md",
"fileSize": "17922.601KB",
"contIntegration": "https://codecov.io/github/nevrome/bleiglas?branch=master",
"developmentStatus": "https://www.repostatus.org/#inactive",
"keywords": [
"r",
"tessellation",
"3d",
"voronoi"
],
"citation": [
{
"@type": "ScholarlyArticle",
"datePublished": "2021",
"author": [
{
"@type": "Person",
"givenName": "Clemens",
"familyName": "Schmid"
},
{
"@type": "Person",
"givenName": "Stephan",
"familyName": "Schiffels"
}
],
"name": "{bleiglas}: An {R} package for interpolation and visualisation of spatiotemporal data with 3D tessellation",
"identifier": "10.21105/joss.03092",
"url": "https://doi.org/10.21105/joss.03092",
"pagination": "3092",
"@id": "https://doi.org/10.21105/joss.03092",
"sameAs": "https://doi.org/10.21105/joss.03092",
"isPartOf": {
"@type": "PublicationIssue",
"issueNumber": "60",
"datePublished": "2021",
"isPartOf": {
"@type": [
"PublicationVolume",
"Periodical"
],
"volumeNumber": "6",
"name": "Journal of Open Source Software"
}
}
}
],
"releaseNotes": "https://github.com/nevrome/bleiglas/blob/master/NEWS.md"
}
GitHub Events
Total
Last Year
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Clemens Schmid | c****s@n****e | 226 |
| Stephan Schiffels | s****s@m****m | 6 |
| Daniel S. Katz | d****z@i****g | 1 |
| Arfon Smith | a****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 13
- Total pull requests: 8
- Average time to close issues: 12 days
- Average time to close pull requests: 17 days
- Total issue authors: 5
- Total pull request authors: 4
- Average comments per issue: 1.08
- Average comments per pull request: 2.0
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- fabian-s (5)
- corybrunson (4)
- nevrome (2)
- vissarion (1)
- stschiff (1)
Pull Request Authors
- nevrome (4)
- stschiff (2)
- arfon (1)
- danielskatz (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- R >= 3.5.0 depends
- Rcpp * imports
- checkmate * imports
- data.table * imports
- knitr * suggests
- pbapply * suggests
- rmarkdown * suggests
- sf * suggests
- testthat * suggests
