Landuses – Area Test

0
929

This is duplicate post of a discussion I started on ESRI’s CityEngine support forum

I’ve already outlined a way to allocate landuses based on a static shape layer, as we get nearer placing buildings on our plots we need to ensure that the “lots” are the correct size and shape.

This following rule can be adapted to test a Lot’s area (in sqm) and then onto the next rule depending on its area. I’ve used this to place different building types on a lot depending on it’s area but you could just as easily tie this into the woodland rule set above…

//the descriptive names can be changed and are more of a guide really change or add more areas for your needs
attr areatest =
	case geometry.area < 100 : "100orLess"
	case geometry.area < 200 && geometry.area > 100 : "100to200"
	case geometry.area < 300 && geometry.area > 200 : "200to300"
	case geometry.area < 400 && geometry.area > 300 : "300to400"
	case geometry.area < 500 && geometry.area > 400 : "400to500"
	case geometry.area < 600 && geometry.area > 500 : "500to600"
	case geometry.area < 700 && geometry.area > 600 : "600to700"
	case geometry.area < 800 && geometry.area > 700 : "700to800"
	case geometry.area < 900 && geometry.area > 800 : "800to900"
	case geometry.area < 1000 && geometry.area > 900 : "900to1000"
	case geometry.area > 1000 : "1000orMore"
	else : "0"

Lot-->
   res_areatest

//this directs the rule to the appropriate model depending on the area size
res_areatest-->
	case areatest == "100orless" : res_100orless
	case areatest == "100to200" : res_100to200
	case areatest == "200to300" : res_200to300
	case areatest == "400to500" : res_400to500
	case areatest == "500to600" : res_500to600
	case areatest == "600to700" : res_600to700
	case areatest == "700to800" : res_700to800
	case areatest == "800to900" : res_800to900
	case areatest == "900to1000" : res_900to1000
	case areatest == "1000orMore" : res_1000orMore
	else : stop.	

res_100orless-->
	extrude(5) report("1000", geometry.area())
//etc....

As usual does anyone have any thoughts/suggestions/corrections?