compas.utilities.geometric_key_xy(xy, precision=None, sanitize=True)[source]

Convert XY coordinates to a string that can be used as a dict key.

  • xy (list of float) – The XY(Z) coordinates.

  • precision (str, optional) – A formatting option that specifies the precision of the individual numbers in the string. Supported values are any float precision, or decimal integer ('d'). Default is None, inwhich case the global precision setting will be used (compas.PRECISION).

  • sanitize ({True, False}, optional) – Flag that indicates whether or not the input should be cleaned up. Default is True.


str – The string representation of the given coordinates.


>>> from math import pi
>>> geometric_key_xy([pi, pi, pi])

See also


Create geometric keys for 3D coordinates