Select to view content in your preferred language

# Applying Labels - CE 2017

617
1
07-13-2017 02:44 AM
New Contributor III

Hello

I have seen that the new CE gives the possibility to use labels, as a way of communicating between different start shapes. I'm trying to write a script which lets me color the white squares according to the color of the shapes that is next to the it.

this is the rule so fare:

attr elevationNumber = 0
@range (0.0,1.0)
attr minElevation = 0.2
@range (0.0,1.0)
attr maxElevation = 0.6

@Startrule
lot -->
case elevationNumber <= minElevation: color(0,0,0)
case elevationNumber >= maxElevation: color(0,0,0)
else: color(1,1,1)

My idear is to label the each shape and then make the rule check the color of the adjacent tiles.

Hope that somebody has experiences with using labels and can point me in the right direction.

Tags (1)
1 Solution

Accepted Solutions
Esri Regular Contributor

Labels work with occlusion queries (inside, overlaps, touches).  You can give something a label, and then in another shape, you can check if you occlude with something that has a given label.

What you could do is extrude your shapes and assign a label to the extruded shapes.  For example, the black shapes would get the label "black".  Then, you could use the touches() query with the label "black" to see if the shape touches another shape with the label "black".

``````attr elevationNumber = 0
@range (0.0,1.0)
attr minElevation = 0.2
@range (0.0,1.0)
attr maxElevation = 0.6

Lot -->
case elevationNumber <= minElevation: color(0,0,0) Cube("black")
case elevationNumber >= maxElevation: color(0,0,0) Cube("black")
else: color(1,1,1) Cube("white")

Cube(colorLabel) -->
extrude(10)
label(colorLabel)
TestNeighbor

TestNeighbor -->
case touches(inter, "black"):
s('1,20,'1)
else:
X.‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍``````
Esri Regular Contributor

Labels work with occlusion queries (inside, overlaps, touches).  You can give something a label, and then in another shape, you can check if you occlude with something that has a given label.

What you could do is extrude your shapes and assign a label to the extruded shapes.  For example, the black shapes would get the label "black".  Then, you could use the touches() query with the label "black" to see if the shape touches another shape with the label "black".

``````attr elevationNumber = 0
@range (0.0,1.0)
attr minElevation = 0.2
@range (0.0,1.0)
attr maxElevation = 0.6

Lot -->
case elevationNumber <= minElevation: color(0,0,0) Cube("black")
case elevationNumber >= maxElevation: color(0,0,0) Cube("black")
else: color(1,1,1) Cube("white")

Cube(colorLabel) -->
extrude(10)
label(colorLabel)
TestNeighbor

TestNeighbor -->
case touches(inter, "black"):
s('1,20,'1)
else:
X.‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍``````