vec2dtransf (version 1.1)

applyTransformation: Apply the transformation to an sp object

Description

The main functionality of this package. Applies the transformation to an sp object, which can have geometry type point, line or polygon and can have an associated data.frame.

Usage

applyTransformation(object, sp.object)

Arguments

object

Object of the class SimilarityTransformation or AffineTransformation

sp.object

An object of type: SpatialPoints, SpatialPointsDataFrame, SpatialLines, SpatialLinesDataFrame, SpatialPolygons or SpatialPolygonsDataFrame

Value

A transformed sp.object

Details

The transformation only affects sp object geometries. Attributes, IDs and other sp object characteristics are preserved.

The transformation can only be applied either on projected spatial data or on spatial data with unknown projection information. Geographic data cannot be transformed due to the nature of the methods (2D Cartesian).

References

Pebesma, E. and Bivand, R. sp package: <URL: http://cran.r-project.org/web/packages/sp/index.html>

See Also

sp, calculateParameters, SimilarityTransformation-class, AffineTransformation-class

Examples

Run this code
# NOT RUN {
# From the sp examples:
x <- c(1,1,1,2,2,2,3,3,3)
y <- c(1,2,3,1,2,3,1,2,3)
xy <- cbind(x,y)
S <- SpatialPoints(xy)

st=SimilarityTransformation(parameters=c(1,0,0.2,-0.2))
trS <- applyTransformation(st, S)
trS # Transformed sp object, have a look at the coordinates
# }

Run the code above in your browser using DataLab