Referencing different styles from within the same CGA file

1805
4
01-30-2013 03:17 AM
NicolaiSteinø
Occasional Contributor
Is there a way to reference different styles within a cga script?

Say you want to render different facade styles (or other characteristics defined by styles) based on a constraint map reference. How do you do that?

In my case, I want to control the amount of new buildings to replace historical buildings in an urban regeneration area by means of a gray scale map indicating the redevelopment ratios for different parts of the area. I have defined old and new building types with different names within one cga file (quite a hassle and not very clean) but I would like to simplify my script (and my work) by using styles. Only, I can't figure out a way to do it.

Can you help?

Thanks,

Nicolai
0 Kudos
4 Replies
MatthiasBuehler1
Frequent Contributor II
Hi !

Calling or referencing styles is currently not possible. If you find out how it works .. Let me know .. :)

So atm, you best map the 'building style' with a map and then define each attr value by a function, e.g. anything in this direction :


myValues(key) =
    case myMappedStyle == "residential" :
        case key == "height" : 6
        case key == "facade texture" : "res_1.jpg"
..
0 Kudos
NicolaiSteinø
Occasional Contributor
OK, thanks.

I'm afraid maps won't do it for me, as my criteria are not necessarily geo specific. But I'll try to think of another approach then.

Styles just seem so neat�?�

Nic
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Note that instead of sampling from images ( maps ), you can also sample object attributes from geometries on other layers !

E.g. if you have polygonal shapes with 'zones' defined as attrs, you can define their layer mapping, then sample for those values from shapes on other layers.

Cheers !
0 Kudos
ChristianGass1
New Contributor III
Rather than keeping building types in a single cga file, it might be easier to split them into separate files and import the cga file for the appropriate building type into a master.cga. The imported building type cga file can be selected conditionally, based on the value from raster constraint map layer. It will keep the code a bit neater and make it more expandable (for more building types.

I'm working on a similar problem (though hadn't considered using styles); you may find the discussions in this thread informative.
0 Kudos