Module: safe_qgis.clipper

InaSAFE Disaster risk assessment tool developed by AusAid -
ISClipper implementation.

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.

safe_qgis.clipper.clipLayer(theLayer, theExtent, theCellSize=None, theExtraKeywords=None, explodeMultipart=True)[source]

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 - 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.

  • 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

  • explodeMultipart - a bool describing if to convert multipart

features into singleparts

Returns:
Path to the output clipped layer (placed in the system temp dir). The output layer will be reprojected to EPSG:4326 if needed.
Raises:
None
safe_qgis.clipper.explodeMultiPartGeometry(theGeom)[source]

Convert a multipart geometry to a list of single parts. This method was adapted from Carson Farmer’s fTools doGeometry implementation in QGIS.

Args:
theGeom - A geometry - if it is multipart it will be exploded.
Returns:
A list of single part geometries
Raises:
None
safe_qgis.clipper.extentToKml(theExtent)[source]

A helper to get a little kml doc for an extent so that we can use it with gdal warp for clipping.

safe_qgis.clipper.tr(theText)[source]

We define a tr() alias here since the ClipperTest implementation below is not a class and does not inherit from QObject.

Args:
theText - string to be translated
Returns:
Translated version of the given string if available, otherwise the original string.

This module forms part of the InaSAFE tool.

Previous topic

Module: safe_qgis.resources

Next topic

Module: safe_qgis.dock_base

This Page