Table Of Contents

Previous topic

Creating data

Next topic

Data operations

This Page

Geometric operations

Getting information

Geometric Area

Layer.getGeometricAreas()

This function calculates the geometric area for the polygons of a map and returns it as a dictionary.

For computational efficiency it’s recommended to store the results on the layer database using the addVariable layer function.

Example

import clusterpy
china = clusterpy.importArcData("clusterpy/data_examples/china")
china.getGeometricAreas()

Centroids

Layer.getCentroids()

Centroid calculation

This function calculates the centroids for the polygons of a map and returns it as a dictionary with the coordinates of each area.

For computational efficiency it’s recommended to store the results on the layer database using the addVariable layer function.

Example

import clusterpy
china = clusterpy.importArcData("clusterpy/data_examples/china")
china.getCentroids()

Bounding box

Layer.getBbox()

this function returns the boundingbox of the layer layer object.

Example

import clusterpy
china = clusterpy.importArcData("clusterpy/data_examples/china")
china.getBbox()

Modifing geometry

Expand geometry

Layer.expand(xproportion, yproportion)

This function scales the layer width and height according to inputs proportions

Parameters:
  • xproportion (float) – proportion to scale x
  • yproportion (float) – proportion to scale y

Example

import clusterpy
china = clusterpy.importArcData("clusterpy/data_examples/china")
china.expand(100, 100)

Transport geometry

Layer.transport(xoffset, yoffset)

This function transports all the coordinates of a layer object on the given offsets.

Parameters:
  • xoffset (float) – length of the translation to be made on the x coordinates
  • yoffset (float) – length of the translation to be made on the y coordinates

Examples

import clusterpy
clusterpy.importArcData("clusterpy/data_examples/china")
china.transport(100, 100)