Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[processing] add Points from vector algorithm
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
python/plugins/processing/script/scripts/Points_from_vector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
##[Example scripts]=group | ||
##Input_raster=raster | ||
##Input_vector=vector | ||
##Output_layer=output vector | ||
|
||
from qgis.core import * | ||
|
||
vector = processing.getobject(Input_vector) | ||
raster = processing.getobject(Input_raster) | ||
|
||
geometryType = vector.geometryType() | ||
if geometryType == QGis.Point: | ||
processing.runalg("qgis:saveselectedfeatures", vector, Output_layer) | ||
elif geometryType == QGis.Line: | ||
processing.runalg("qgis:pointsfromlines", raster, vector, Output_layer) | ||
elif geometryType == QGis.Polygon: | ||
processing.runalg("qgis:pointsfrompolygons", raster, vector, Output_layer) |