Minimum Distance function in Context Query

669
4
06-21-2021 04:48 AM
Kevin_Z
New Contributor

Hi All

Trying to use minimum distance with the label function to run setbackperedge, the function works well when compared with a labeled 2d polygons with shorter length edge returns only one edge. When comparing with polygon with same length edge or longer it returns 3 edges. Is there a work around for that?

version "2020.1"

distA =
case minimumDistance(inter, "Road") < 1 : 0.5
case minimumDistance(inter, "Side") < 1.5 : 2

else : 0


@StartRule

Test-->

setbackPerEdge(distA){all=Lawn | remainder = build}

build-->

extrude(3)
color(1,0,1)
X.

@StartRule

Road-->
color(0,1,1)
label ("Road")
X.

@StartRule

Side-->
color(1,1,0)
label ("Side")
X.



Lawn-->
color("#b3c989")
X.

@CherylLau   @BrianWamsley @DevinLavigne 

0 Kudos
4 Replies
BrianWamsley
Occasional Contributor III

I'm trying to grasp your goals and terminology so that I can help, (I take it the Test = parcel, Road = road, Side = adjacent parcel or "side-street"?) and you want to set the setbacks to the parcel based on the context of a minimum occlusion distance?

If I had to take a quick guess looking at your code, conditional statements (case/else) are only run once and it takes the first "case" to meet the conditions you set (minimum distance to road is 1 meter).  You might structure the code to make sure that it is run once for road and once for side.

My other thought is your question indicates that your are searching for a shape edge's length, which is a different type of test than a minimumDistance occlusion test.  You could run the case statement on the "geometry.du" or "scope.sx" (for example) to test for your conditions.

0 Kudos
CherylLau
Esri Regular Contributor

I'm not sure I understand what you wrote.

 

However, from the image, I'm guessing that you want the magenta building on the right to only have a setback on the side where the cyan road is (let's call this the front edge) and not have any setbacks on any other edge (let's call these the side and back edges).  The image shows that there are setbacks on the side edges, and I think you probably don't want these setbacks to be there.

 

The reason why the setbacks appear on the side edges is because for each of the side edges, the minimum distance to the cyan road shape is less than your threshold.  This is because minimumDistance uses Euclidean distances in entire world coordinate system (meaning, all 3 axes/directions xyz are involved).  In 3D space, the scope of a side edge is still really close to the scope of the cyan road; the distance between the scopes is less than your threshold of 1m.

 

What you probably want is to limit minimumDistance to only look for shapes in front of the edge along the direction of the edge normal.  Unfortunately, we don't have a directional parameter for this in minimumDistance yet, and sorry, I'm not sure what workaround you could use.

0 Kudos
Kevin_Z
New Contributor

Welcome back Cheryl and thanks for the explanation. 
Maybe let me rephrase my intent for this question. What I'm trying to do is to use the  'setbackperedge' function without the need of manually activating "Compute Edge Attributes" and to manually change the attribute array. Especially if the data set involves polygons counts beyond the hundred thousands, manual data manipulation would defeat the purpose of using city engine. Hence my assumption was to use minimum distance or touches to identify the edge that touches or is the closest to the next polygon will be set back accordingly.

So my work around question is can I use setbackperedge on data with the current CGA function and not involve any manual manipulation of data ?

 

0 Kudos
BrianWamsley
Occasional Contributor III

After some messages with @Kevin_Z  we identified a need for increased minimumDistance functionality, as Cheryl deduced as well.   I created a little image of what I think would enhance minimumDistance for the purpose that Kevin is describing and showed in his image.  This version of minimumDistance combined with GIS data would create some great new abilities for zoning and parcel data research.  However, while I believe that using minimumDistance defined perpendicular from an edge would be an upgrade to the functionality, I understand that it still would not be a total solution for this use case. 

minimumDistance_Idea.PNG

 

0 Kudos