I want to calculate how many buildings there are?

607
2
12-19-2019 01:11 PM
MikeJane
New Contributor III

Hi everyone, 

   I want to see automatically how many buildings are built in the parcel.I need to see this value as a number to use it in other operations. (reports,gfa,far calculations etc.) How can I do that?

   This is my test rule and test result. In this case rule generated 5 building. Thank you...

@Hidden
attr length = 30
attr width = 30

Generate-->
split(x) { 25 : Garden | length : split(z) { 25: Garden | width:Building}*}*

Building-->
case geometry.area < length*width -5 : Garden
else :
extrude(30)

0 Kudos
2 Replies
AlanKlys
Occasional Contributor

You could simply report it but that's not really usable for aggregated internal calculations unless you do it with Python.

Here's one that calculates number of dwellings per hectare.

PS: I colour the bottom splits just for a visual check. Not that you can see it from this angle.  

 

version "2019.1"

@Hidden
attr length = 30
attr width = 30

// Added this  --------------------------------------------------------------
attr buildingNumber = 0
attr parcelArea = geometry.area
// Added this  --------------------------------------------------------------

Generate-->
split(x) { 25 : Garden | length : split(z) { 25: Garden | width:Building}*}*

Building-->
case geometry.area < length*width -5 : Garden
else :
	extrude(30)
// Added this  --------------------------------------------------------------
	comp(f) { bottom : label("countBuilding") countBuildings | all : NIL. }
	
countBuildings -->
	color(1,0,0)
	set(buildingNumber,contextCount(intra, "countBuilding"))
	print("Dwelling Density Per Ha " + buildingNumber/(parcelArea/10000))
	print("Building Count " + buildingNumber)
// Added this  --------------------------------------------------------------
MikeJane
New Contributor III

Thank you , i would get it...

0 Kudos