### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe_qgis »

# 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)

  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)

  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)

  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)

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

  Note

  see http://tinyurl.com/pyqt-differences

  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.

### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe_qgis »