Calculate length of a polygon

5675
14
11-27-2014 07:02 AM
Occasional Contributor

Hi, I’m thinking of a way show me a length of a shape, and use the value I can calculate on. Maybe there is another way, and maybe this is not even possible. But this is my thought.

I’m creating an InnerRect, and I would like to the left or right side length, and the front and back length. I haven’t found anything saying that this is possible. So I thought if I split the InneRect with 1 meter in the X direction, that will give me a polygon with a geometry area of the length. Could I use that in some way to write the information to an attribute to be used for further calculation? Let’s say I want my width as well I could divide my total area with my split. I have no problem getting my length into a report. I would rather not go this way, since it will double up the polygon count, but it is the only way I can think of, getting close to what I need.

14 Replies
Occasional Contributor

I could try to explain my project. I'm trying to figure out how to calculate the roof form, using lidar information. Because of the complexity of almost any building polygon I had this idea.

If I use the innerect function I would get the biggest possible square polygon. Then I have used the scatter function, and created 1 point centered on each line on the innerect  and 1 point in the center of the innerect. 5 points in total. Transferred those to a file gdb, and assigned the height to each point, and joined the five values to the building polygon. With those 5 height values, I'm pretty sure that I can calculate the most roof forms.

So now I'm missing the slope of the roof. Cos or something but without the depth divided by two, I'm missing a value to create that calculation.

Any other ideas?

by Anonymous User
Not applicable

One thing to know, since you mentioned innerRect... that function is dependent on the current scope alignment:

From help file:

The innerRect operation finds for each face of the current shape's geometry the largest rectangle with sides parallel to the scope's x- and y-axes which is fully inside the face.

So watch out for that.

Concerning lengths of shapes, can you not use scope.sx and/or scope.sz for measuring?

Occasional Contributor

How do I  rotate the scope for use of roofshed? I just heart Matt tell about the most important thing in writing .cga is to understand the scope. So I probably should get on learning that. The help guide, seems to me kinda confusing when I trie to read up on the scope. What I need to do, is to dynamically change the direction of the roofshed, so it would always take the longest side and make the slope from that point. Right now they all angle in the same direction.

By the way the scope.sx and sz was very helpful

Regular Contributor

Is it enough to just know the roof type? I figured the roof would still be generated from a base footprint oriented in the right direction, unless the roof tops themselves are changing.

In terms of getting something to align to the longest side...it might be possible to use alignScopetoGeometry for this one Kenneth.

If you see the documentation, it is possible to select the longest edge to align too. I have used this function a lot to dynamically adjust inserted objects on street networks. It is not perfect, but it works for most shifting streets. I am not sure if this is what you need though.

• edgeSelector (selstr)
• world.lowest: takes the edge with lowest y world-coordinates.
• longest: takes the longest edge.
David Wasserman, AICP
Regular Contributor

Hi Kenneth,

Chris is right you can use scope.sx or scope.sz...Sometimes however (I work A LOT with streets), I depend on the UV spaces for my geometry measurements.

I often use geometry.du(0,unitSpace)/geometry.dv(0,unitSpace). I have had this feed straight into reporting and into rule choices pretty successfully.

Hope this is helpful,

David

PS: Let us know what progress you make on LIDAR interpolated roof forms, it is a very interesting problem.

David Wasserman, AICP
Occasional Contributor

Thank you gyus. I will give you the short story, since I’m not done. My plan is to post my idea if I ever succeed!

First I used the InnerRect to take care of funny building forms. As you mention Chris, I will then get the biggest possible rectangle. I use the Scatter operation to create points on the center of each line created with the InnerRect Including the total center of the inneRect, exported it to a file geodatabase, and it looked like this:

Then I use a model to assign height information to each point, from my DSM created from my Lidar. I modified this a little from the picture you see. I basecly create a Buffer around each point, and take the highest value, and assign that to the building attributes - left, right, front etc.

Then I found a geoprocessing tool “Near” and created the distance between center and left point, and center and front point. That gave me actually what I was trying to achieve with my post here. I could use that to calculate the slope:

//Calculates the roofslope. The + 0.5 is to minimize the buffer created in ArcMAP Roof_Form Model

attr Roof_Slope =

case Left_Dist < Front_Dist : atan(Left_to_Center_H / (Left_Dist + 0.5))

else : atan(Front_to_Center_H / (Front_Dist + 0.5))

So now I need to figure out the roof form. If center, left, right equals, but front and back is bellow roofgable, and so on, but I need to take in count that one of the height can fall out crazy, and should be leaved out. This will not be 100% accurate, my tests has shown around 60-70 % which in my opinion is okay, maybe I can get it higher, but the Lidar also have some complications with classification and asphalt roofs. Next year all the municipalities needs to draw all the buildings, and divide them by different buildings. Right now each building touching each other is drawn in one polygon. That is defiantly complicates things.

Regular Contributor

Cool research !!

Keep us posted !

Good luck !

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

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

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

Regular Contributor

Wow. It looks like you have everything you need to set up a logistic regression equation set for classification of roof types. This is pretty intense data and processing.

David Wasserman, AICP
by Anonymous User
Not applicable

David, can you set up a logistic regression equation for this?