VectorMerger¶
Merges two vectors with the same fields into a single one, as the maps of two adjacent areas or the results of two filters on the same vector.
Details¶
The vectors must have the same geometry type and the same fields, with the same names, types and order, and the same crs: a vector with more or fewer fields stops the merge, as one in another crs, which would need VectorReprojector first. The features are copied as they are, the ones of the first vector first, without joining the geometries that touch or overlap: the merge of two maps of adjacent areas has both the features along their border.
Parameters¶
Merges vectors with the same fields into a single one.
Toolbox folder: Vector Processing
Status: Certified
Keywords: IO, Feature, Vector, Merge
Authors: Andrea Antonello
Class: org.hortonmachine.modules.VectorMerger
Inputs
Parameter |
Type |
Unit |
Default |
Description |
|---|---|---|---|---|
|
vector file |
The first vector to be merged. |
||
|
vector file |
The second vector to be merged. |
Outputs
Parameter |
Type |
Unit |
Description |
|---|---|---|---|
|
output file |
The output vector. |
Example¶
The example filters the lowest cells of the grid of RasterCatToFeatureAttribute, those entirely below 1500 m, and merges them with the highest ones of the VectorFilter example:
import org.hortonmachine.modules.VectorFilter
import org.hortonmachine.modules.VectorMerger
// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"
// the lowest cells, to merge with the highest ones of the VectorFilter example
var filter = new VectorFilter()
filter.inVector = folder + "grid_elev.shp"
filter.pCql = "elev_max < 1500"
filter.outVector = folder + "grid_low.shp"
filter.process()
var merger = new VectorMerger()
merger.inVector1 = folder + "grid_high.shp"
merger.inVector2 = folder + "grid_low.shp"
merger.outVector = folder + "grid_extremes.shp"
merger.process()
The merged vector has the 3 high cells and the 12 low ones in the valley to the west: