contextCompare function (context query)


float contextCompare(target, label, comparisonType)



The rank of the current shape among all shapes that match the given label. The comparison is performed wrt. the given comparisonType selector. Ranks are 0-based, i.e. the first position has rank 0. If several shapes share an equal comparision value, the lowest possible rank is returned. If no shape is found matching the specified label, 0 is returned.


A context query that returns the rank of the current shape geometry among other labeled shape geometries according to a specific comparator.

Learn more about important characteristics for context queries in conditions and inter context.

Each label operation does not "label" the current shape but rather creates a new labeled shape that counts as one rank position separately.



Lot --> extrude(rand(10)) label("label") Color

Color -->
    case contextCompare(inter, "label", world.highest) == 0 :
    case contextCompare(inter, "label", world.lowest) == 0 :
    else :
This example applies the Lot rule to a set of initial shapes (inter context). Each lot is extruded by a random value and labeled with "label". The highest geometry is colored in red. In the second case statement, all geometries share the lowest ranking, so the remaining geometries are colored in green.

Copyright ©2008-2023 Esri R&D Center Zurich. All rights reserved.