Contact : ole.moller.nielsen@gmail.com
Note
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Clip a geometry (linestring or polygon) using a clip polygon.
To do this we combine the clip polygon with the input geometry which will add nodes to the input geometry where it intersects the clip polygon. Next we get the symmetrical difference between the input geometry and the combined geometry.
with. Multipart polygons are not supported so the client needs to take care of that.
clipped.
Clip a Hazard or Exposure layer to the extents provided.
Note
Will delegate to clipVectorLayer or clipRasterLayer as needed.
Args:
theLayer - a valid QGIS vector or raster layer
- theExtent either: an array representing the exposure layer
extents in the form [xmin, ymin, xmax, ymax]. It is assumed that the coordinates are in EPSG:4326 although currently no checks are made to enforce this.
or: A QgsGeometry of type polygon. **Polygon clipping is
currently only supported for vector datasets.**
- theCellSize - cell size which the layer should be resampled to.
This argument will be ignored for vector layers and if not provided for a raster layer, the native raster cell size will be used.
- theExtraKeywords - Optional keywords dictionary to be added to
output layer.
- theExplodeFlag - a bool specifying whether multipart features
should be ‘exploded’ into singleparts. This parameter is ignored for raster layer clipping.
- theHardClipFlag - a bool specifying whether line and polygon features
that extend beyond the extents should be clipped such that they are reduced in size to the part of the geometry that intersects the extent only. Default is False. This parameter is ignored for raster layer clipping.
Convert a multipart geometry to a list of single parts. This method was adapted from Carson Farmer’s fTools doGeometry implementation in QGIS.
Convert the supplied extent to geographic and return as as array.
theExtent: QgsRectangle to be transformed to geocrs. theSourceCrs: QgsCoordinateReferenceSystem representing the original
extent’s CRS.
A helper to get a little kml doc for an extent so that we can use it with gdal warp for clipping.
We define a tr() alias here since the ClipperTest implementation below is not a class and does not inherit from QObject.
Note
This module forms part of the InaSAFE tool.