Repository logo

Midlines R package

No Thumbnail Available



Change log



A .tar.gz file containing an R package. The package can be used to estimates the midline of polygons provided in sf format. The package uses Voronoi tessellation to estimate the midline and offers some functions that can help to clean the lines.

The package comains the following main functions: the midlines_draw function is used to estimate a midline for a polygon input. The midlines_clean function takes the output from midlines_draw to remove extraneous lines creates by the Voronoi tessellation process. The function midlines_check allows the cleaning process to be examined to ensure the desired output is created. midlines_dedensify, midlines_debit and midlines_smooth offer additional helper functions to modify the estimated midlines.

The package requires (imports) the sf, zoo, lwgeom, stats and igraph packages and requires R version 2.10 or higher. The package is documented with help files, a vignette, a readme file, a description file and licence (MIT licence). A small example dataset is included to provide an example for the vignette.


Software / Usage instructions

This is an R package so R statistical software ( is necessary to use it. The package is available as a .tar.gz file. A copy of this stored on your local machine can be installed using the following command in the R terminal: install.packages("midlines.tar.gz", repos = NULL, type = "source") The untar R command can be used to extract or explore the contents of midlines.tar.gz. For example: untar("midlines.tar.gz", list=TRUE) ## check contents untar("midlines.tar.gz") The untar and install.packages commands require that the tar.gz file to be in the working directory (or the full file path to be specified). To explore the .tar.gz on a Windows machine without R requires a third-party application (such as 7zip). This can be done natively on Linux or Mac machines. An alternative to installing the tar.gz file is to install the most recent version of the package from GitHub ( with: # install.packages("devtools") # library(devtools) devtools::install_github("RichardPatterson/midlines") N.B. to install midlines from GitHub, you will need to install and attach the devtools package if you have not already done so.


Centerline, Centreline, Midlines, Network, R, sf


MRC (MC_UU_00006/7)