QGIS API Documentation
2.8.2-Wien
|
The QGis class provides vector geometry analysis functions. More...
#include <qgsgeometryanalyzer.h>
Public Member Functions | |
bool | buffer (QgsVectorLayer *layer, const QString &shapefileName, double bufferDistance, bool onlySelectedFeatures=false, bool dissolve=false, int bufferDistanceField=-1, QProgressDialog *p=0) |
Create buffers for a vector layer and write it to a new shape file. | |
bool | centroids (QgsVectorLayer *layer, const QString &shapefileName, bool onlySelectedFeatures=false, QProgressDialog *p=0) |
Calculate the true centroids, or 'center of mass' for a vector layer and write it to a new shape file. | |
bool | convexHull (QgsVectorLayer *layer, const QString &shapefileName, bool onlySelectedFeatures=false, int uniqueIdField=-1, QProgressDialog *p=0) |
Create convex hull(s) of a vector layer and write it to a new shape file. | |
bool | dissolve (QgsVectorLayer *layer, const QString &shapefileName, bool onlySelectedFeatures=false, int uniqueIdField=-1, QProgressDialog *p=0) |
Dissolve a vector layer and write it to a new shape file. | |
bool | eventLayer (QgsVectorLayer *lineLayer, QgsVectorLayer *eventLayer, int lineField, int eventField, QgsFeatureIds &unlocatedFeatureIds, const QString &outputLayer, const QString &outputFormat, int locationField1, int locationField2=-1, int offsetField=-1, double offsetScale=1.0, bool forceSingleGeometry=false, QgsVectorDataProvider *memoryProvider=0, QProgressDialog *p=0) |
Creates an event layer (multipoint or multiline) by locating features from a (non-spatial) event table along the features of a line layer. | |
bool | extent (QgsVectorLayer *layer, const QString &shapefileName, bool onlySelectedFeatures=false, QProgressDialog *p=0) |
Create a polygon based on the extent of all (selected) features and write it to a new shape file. | |
QgsGeometry * | locateAlongMeasure (double measure, QgsGeometry *lineGeom) |
Returns linear reference geometry. | |
QgsGeometry * | locateBetweenMeasures (double fromMeasure, double toMeasure, QgsGeometry *lineGeom) |
Returns linear reference geometry as a multiline (or 0 if no match). | |
bool | simplify (QgsVectorLayer *layer, const QString &shapefileName, double tolerance, bool onlySelectedFeatures=false, QProgressDialog *p=0) |
Simplify vector layer using (a modified) Douglas-Peucker algorithm and write it to a new shape file. |
The QGis class provides vector geometry analysis functions.
Definition at line 36 of file qgsgeometryanalyzer.h.
bool QgsGeometryAnalyzer::buffer | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
double | bufferDistance, | ||
bool | onlySelectedFeatures = false , |
||
bool | dissolve = false , |
||
int | bufferDistanceField = -1 , |
||
QProgressDialog * | p = 0 |
||
) |
Create buffers for a vector layer and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
bufferDistance | distance for buffering (if no buffer field is specified) |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
dissolve | if true, merge all the buffers to a big multipolygon |
bufferDistanceField | index of the attribute field that contains the buffer distance (or -1 if all features have the same buffer distance) |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 756 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::centroids | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
bool | onlySelectedFeatures = false , |
||
QProgressDialog * | p = 0 |
||
) |
Calculate the true centroids, or 'center of mass' for a vector layer and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 146 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::convexHull | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
bool | onlySelectedFeatures = false , |
||
int | uniqueIdField = -1 , |
||
QProgressDialog * | p = 0 |
||
) |
Create convex hull(s) of a vector layer and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
uniqueIdField | index of the attribute field that contains the unique convex hull id (or -1 if all features have the same buffer distance) |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 389 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::dissolve | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
bool | onlySelectedFeatures = false , |
||
int | uniqueIdField = -1 , |
||
QProgressDialog * | p = 0 |
||
) |
Dissolve a vector layer and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
uniqueIdField | index of the attribute field that contains the unique id to dissolve on (or -1 if all features should be dissolved together) |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 599 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::eventLayer | ( | QgsVectorLayer * | lineLayer, |
QgsVectorLayer * | eventLayer, | ||
int | lineField, | ||
int | eventField, | ||
QgsFeatureIds & | unlocatedFeatureIds, | ||
const QString & | outputLayer, | ||
const QString & | outputFormat, | ||
int | locationField1, | ||
int | locationField2 = -1 , |
||
int | offsetField = -1 , |
||
double | offsetScale = 1.0 , |
||
bool | forceSingleGeometry = false , |
||
QgsVectorDataProvider * | memoryProvider = 0 , |
||
QProgressDialog * | p = 0 |
||
) |
Creates an event layer (multipoint or multiline) by locating features from a (non-spatial) event table along the features of a line layer.
Note that currently (until QgsGeometry supports m-values) the z-coordinate of the line layer is used for linear referencing
lineLayer | layer with the line geometry |
eventLayer | layer with features and location field |
lineField | join index in line layer |
eventField | join index in event layer |
outputLayer | name of output file (can be empty if a memory layer is used) |
outputFormat | name of output format (can be empty if a memory provider is used to store the results) |
unlocatedFeatureIds | out: ids of event features where linear referencing was not successful |
locationField1 | attribute index of location field in event layer |
locationField2 | attribute index of location end field (or -1 for point layer) |
offsetField | attribute index for offset field. Negative offset value = offset to left side, positive value = offset to right side |
offsetScale | factor to scale offset |
forceSingleGeometry | force layer to single point/line type. Feature attributes are copied in case of multiple matches |
memoryProvider | memory provider to write output to (can be 0 if output is written to a file) |
p | progress dialog or 0 if no progress dialog should be shown |
Definition at line 914 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::extent | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
bool | onlySelectedFeatures = false , |
||
QProgressDialog * | p = 0 |
||
) |
Create a polygon based on the extent of all (selected) features and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 262 of file qgsgeometryanalyzer.cpp.
QgsGeometry * QgsGeometryAnalyzer::locateAlongMeasure | ( | double | measure, |
QgsGeometry * | lineGeom | ||
) |
Returns linear reference geometry.
Unlike the PostGIS function, this method always returns multipoint or 0 if no match (not geometry collection). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)
Definition at line 1241 of file qgsgeometryanalyzer.cpp.
QgsGeometry * QgsGeometryAnalyzer::locateBetweenMeasures | ( | double | fromMeasure, |
double | toMeasure, | ||
QgsGeometry * | lineGeom | ||
) |
Returns linear reference geometry as a multiline (or 0 if no match).
Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)
Definition at line 1197 of file qgsgeometryanalyzer.cpp.
bool QgsGeometryAnalyzer::simplify | ( | QgsVectorLayer * | layer, |
const QString & | shapefileName, | ||
double | tolerance, | ||
bool | onlySelectedFeatures = false , |
||
QProgressDialog * | p = 0 |
||
) |
Simplify vector layer using (a modified) Douglas-Peucker algorithm and write it to a new shape file.
layer | input vector layer |
shapefileName | path to the output shp |
tolerance | (level of simplification) |
onlySelectedFeatures | if true, only selected features are considered, else all the features |
p | progress dialog (or 0 if no progress dialog is to be shown) |
Definition at line 30 of file qgsgeometryanalyzer.cpp.