bmsasilva / sptools

R package with tools for editing, creating or converting "sp" spatial objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SPTools

Duccio Aiazzi

SPTools is a package to create, edit and convert spatial objects of the package "sp".

Installation

Install SPTools from its GitHub repository. You first need to install the sp and devtools packages.

install.packages(c("sp", "devtools"))

Then install SPTools using the install_github function in the devtools package.

library(devtools)
install_github("duccioa/sptools")

Example use

splitLines splits each single line contained in a SpatialLines object into segments of a specific length.

library("sptools")
c1 = cbind(c(0,2,5,7), c(0,2,3,3))
l1 = Line(c1)
sl = list(Lines(list(l1), ID = 1))
SP = SpatialLines(sl)
plot(SP)
SPs = splitLines(SP, 0.4, plot.results = T)

linedf2SpatialLines converts a dataframe with IDs and coordinates into a SpatialLines object.
SpatialLines2df performes the reverse operation, extracting the coordinates and IDs of each lines of a SpatialLines object and put into a dataframe.
createBox and createCircle create a rectangle and a polygon approximating a circle in the form of a SpatialPolygons object.

Licenses

The SPTools package as a whole is distributed under [GPL-3 (GNU General Public License version 3)[http://www.gnu.org/licenses/gpl-3.0.en.html].

About

R package with tools for editing, creating or converting "sp" spatial objects


Languages

Language:R 100.0%