Select to view content in your preferred language

cga Building Rules

5351
6
06-17-2016 11:04 AM
MichaelNelson3
Emerging Contributor

I'm new to CityEngine but I've made some progress learning the program by reviewing some of the tutorials.  I received a building footprint zip file from the Southeast Michigan Council of Governments (SEMCOG) that contains a shape file package.  The package .dbf file has building square footage, number of stories, building height etc (see attached).  Can you provide or identify the location of a .cga file that I can use or modify in my project to extrude the buildings to the correct configuration? I've used some of the .cga building rules in some of the examples without much luck.  Most of the footprints are ok but various buildings have the incorrect number of floors and heights.

Thanks,

mlnelson2@charter.net

0 Kudos
6 Replies
LR
by
Frequent Contributor

Assuming you use the median height to extrude, you first have to convert it from feet to meter, since CE only uses that:

attr MEDIAN_HEIGHT = 0 #connect this attribute
@Hidden
attr MEDIAN_HM = MEDIAN_HEIGHT/3.2808 #feet to meter

Lot -->
  extrude(MEDIAN_HM)

If you have faulty data, you could use some case checking to "fix" it, like this:

attr MEDIAN_HEIGHT = 0
attr MEDIAN_HM = MEDIAN_HEIGHT/3.2808
attr FixHeight = 10 # in feet

Lot -->
  case MEDIAN_HEIGHT == 0: FixBuilding
  else: ExtrudeBuilding

ExtrudeBuilding -->
  extrude(MEDIAN_HM)

FixBuilding -->
  set(MEDIAN_HEIGHT, FixHeight)
  ExtrudeBuilding

You could also use something like STORIES*storyheight (if it exists) as building height.

Brownschuh
Frequent Contributor

You provided some pretty simple, yet extremely valuable information.  I was wondering why my buildings were extruding artificially high, all the while not realizing CE defaults to meters.  Obviously I needed to convert my data to feet, but I must have missed that in the tutorials I was following ... in any event, I am appreciative of your post.  

0 Kudos
MichaelNelson3
Emerging Contributor

I tried revising the attached Building_From_Footprint.cga rule file so it would extrude all building footprints contained in a shape file package I received from the Southeast Michigan Council of Governments (SEMCOG) using the number of stories (column "STORIES") and building height (column "MEDIAN_HEIGHT") information in the .dbf file without any luck.  I'm not a programmer but I've reviewed the tutorials and I just do not get it.  Can someone modify the attached Building_From_Footprint.cga rule file such that it correctly extrudes the building footprints?

I also tried revising the attached Standard_Street.cga rule file so it would create the correct number of lanes for all of the streets contained in a shape file package I received from the Southeast Michigan Council of Governments (SEMCOG) file package using the number of lanes (column "NUMBER_LAN") information in the .dbf file without any luck.  Can someone also modify the attached Standard_Street.cga file such that it correctly builds the streets with the correct number of lanes?

Thanks

0 Kudos
DevinLavigne
Frequent Contributor

I'll take a look, but can you post your zip file, or a sample of it? Also what version of CityEngine are you using?

0 Kudos
MichaelNelson3
Emerging Contributor

Attached is a copy of the zip files.  I'm using CityEngine 2015.2

Thanks

0 Kudos
DevinLavigne
Frequent Contributor

Well, it wasn't behaving right for me either - so don't be hard on yourself. When an attribute is named to match a GIS field, the connection should happen automatically. For your data, it wasn't, which was odd - maybe it was the size of the data? Anyway, there is a way to map those attributes manually - see the help file for Connection Editor. Once they were mapped the code below worked perfectly.

const unitScale = case Unit=="Feet": 0.3048006096012192 else: 1

@Range("Feet", "Meters")
attr Unit = "Feet"

@Range (0.5,200)
attr STORIES = 0 #Should be a GIS Driven Attribute but I had to "Connect" it manually

@Range (0,10000)
attr MEDIAN_HGT = 0 #Should be a GIS Driven Attribute but I had to "Connect" it manually

@Hidden
attr MEDIAN_HGT_feet = MEDIAN_HGT * unitScale

@StartRule
Footprints-->  extrude(MEDIAN_HGT_feet)
               split(y) {MEDIAN_HGT_feet/STORIES:Floor}* #comment this out if you don't want floors/horizontal splits

Screen Shot 2016-07-30 at 2.31.18 AM.png

I also saw something that was odd and - see above - the building has 20 stories, but the Median Height of the building is only 124 feet. So just a point of caution. Another note, the building in the foreground is 4.5 stories, in case you were wondering what was going on with the short top floor.

Hope this helps.

Devin