VectorTransformer

Moves the geometries of a vector: rotates them, all together, around a center, and translates them. It puts in place a survey made in local coordinates, or a design to try in another position, without changing the crs.

Details

The rotation, if given, comes first: all the geometries rotate together, clockwise by the angle, around the same point, so the vector keeps its shape. The point is the given center or, without it, the center of the bounds of the whole vector, which changes with the features that the vector has: give the center to rotate around a known point, as a survey around its station. The translation then moves them by the given amounts, in the units of the crs, east and north for positive values. The crs doesn’t change: the module moves the geometries, as to put in place a survey in local coordinates or a design to try in another position, it doesn’t reproject them.

Parameters

Moves the geometries of a vector by a translation and rotates them around the center of the vector.

Toolbox folder: Vector Processing
Status: Certified
Keywords: Transform, Vector, Translate, Rotate
Authors: Andrea Antonello
Class: org.hortonmachine.modules.VectorTransformer

Inputs

Parameter

Type

Unit

Default

Description

inVector

vector file

The feature collection that has to be transformed.

pTransX

double

0

The translation along the X axis.

pTransY

double

0

The translation along the Y axis.

pRotate

Double

The optional rotation angle, in clockwise degrees.

pCenterX

Double

The optional X of the center of the rotation, with its Y (default: the center of the bounds of the vector).

pCenterY

Double

The optional Y of the center of the rotation, with its X (default: the center of the bounds of the vector).

Outputs

Parameter

Type

Unit

Description

outVector

output file

The transformed feature collection.

Example

The example turns the cells of GridsGenerator by 30 degrees clockwise around their lower left corner, and moves them 300 m east:

import org.hortonmachine.modules.VectorTransformer

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

var transformer = new VectorTransformer()
// the cells of GridsGenerator
transformer.inVector = folder + "grid.shp"
// turned by 30 degrees clockwise around their lower left corner
transformer.pRotate = 30.0
transformer.pCenterX = 1637140.0
transformer.pCenterY = 5110830.0
// and moved 300 m east
transformer.pTransX = 300.0
transformer.pTransY = 0.0
transformer.outVector = folder + "grid_rotated.shp"
transformer.process()

The moved grid in red, over the original one in blue: the corner of the rotation, at the lower left of the original grid, is now 300 m to its east:

The grid rotated by 30 degrees and moved 300 m east, over the original grid