# Finding Number of Edges a Plot Shares with a Street

3613
6
07-02-2015 02:34 AM
New Contributor

Can somebody help me in writing a rule which can tell how many edges does a plot share with the street and apply different rules according to it.

Example: If it is a corner plot then it shares 2 of its edges with the street. Hence a different rule applies to it than to a site which shares only one edge. For now it is a user defined value :

@Range("CLASS_A","CLASS_B", "CLASS_C")

attr Type = "CLASS_A"

Lot -->

case Type == "CLASS_A" : LotA     #shares one edge, apply rule LotA#

case Type == "CLASS_B" : LotB     #shares two edges, apply rule LotB#

case Type == "CLASS_C" : LotC     #shares three edges, apply rule LotC#

else                 : NIL

I want to write a rule that automatically does that. I can get the number of edges from geometry.egdes(correct me if I am wrong) but I dont know exactly how should I write the rule.

Thanks

Tags (2)
1 Solution

Accepted Solutions
Occasional Contributor III

Hi,

This is a bit tricky to do, but I have done it before, see:

I hope this helps .. (?)

Matthias Buehler

--------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

6 Replies
Occasional Contributor III

Hi,

This is a bit tricky to do, but I have done it before, see:

I hope this helps .. (?)

Matthias Buehler

--------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

New Contributor

Hey! Thanks so much it works I thought it would be an easy one and I was missing some small logic in my mind but I don't fully understand the code. I understood how you are recursively checking each edge of the lot but beyond that I don't understand how are you checking it with the street edges. Can you please explain, especially nStreetEdges.

Thanks

Occasional Contributor III

Hi,

I know this is a tricky one .. and not so intuitive ..

nStreetEdges ("number of street edges") is just a rule parameter I made up that starts with zero, and whenever the current edge in the recursion has a streetWidth attribute that is > 0, I add 1 to this rule parameter.

Note the shape's streetWidth() attributes in the Object Attributes tab (Inspector).

This means after the recursion is done, if nStreetEdges is >= 2, we know this is a corner lot.

Okay?

Matthias Buehler

------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

New Contributor

Yeah! Understood Thanks. I could easily extend it for sites with more than two edges common with the street.

New Contributor III

Hi! I know a lot of time has passed since this original thread was created, but I'm really struggling with Matthias' solution above. The solution is completely logical, and I can follow what the code is intending to do just fine. The only problem is...the streetWidths returned on any lot I run the code on just return 0! I'm missing something, but I'm not sure what. The streetwidth values are there in the Object Attributes in the Inspector when I select the lot, so why isn't the code returning them?!

Can anyone out there help, because this is driving me crazy!!

Esri Regular Contributor