+ Reply to Thread
Results 1 to 22 of 22

Thread: Create Layer of Attribedutes

  1. #1
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Create Layer of Attribedutes

    I'm a newbie stuck with a very newbie problem. I imported a shape file from Arc and was successful in keeping all attributes to the features. However the file lists all 16k and I need to organize them by an attribute (in this case which zoning district they're in) As I stated the all have kept their 'zoning' number, now I just need to organize them by each of those zones, so all the "01" of the 'zoning' attribute are kept together. I think I have to create essentially subfiles, so I should make my scene window looks like

    -Scene Light
    -Panorama
    -All Parcels (16,028)
    • Zoning 1
    • Zoning 2
    • Zoning 3
    • etc
    • etc


    I'm racking my brain if this is right or if the other dozen methods using scripting and rules is the proper way. How do I create these subfiles? How do I select from my dozen attributes the attribute called "zoning" and then select them into "01" and "02" etc. I'm using Pro 2010.3 if it matters. After that I would like to select "stories" (aka height) and multiple it by 10 (10 feet per story)Thanks for any help that can be provided.

  2. #2
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    hi !

    CityEngine handles data a little different than ArcGIS. e.g. there's no spreadsheet available which lets you sort all data.


    --> you can 1 ] select shapes based on attributes
    --> you can use CGA rules to distinguish the attributes for each footprint for the building generation.





    for 1], start with the following docs :

    selecting via attribute values : boolean expression in attribute layer
    - check Manual > Map Layers > Selection via Image Maps
    - check Manual > Mapping Attributes > Mapping Object Attributes via Layer Attribute

    if you have questions here, let me know .. ok ?




    for 2], create and assign a cga rule file to all shapes.

    within the rule file, define an attr :
    Code:
    attr zoning = ""       # this is a string definition
    assign the rule file to all shapes and use the connection editor to point the attribute to the imported Object Attribute (GIS data), not the rule value.

    from there, you can use "case.. else" statements to distinguish all sorts of things.

    example :
    Code:
    attr zoning = ""
    
    Lot -->
        case zoning == "01" :
            color(1,0,0)
            Shape01.
        case zoning == "02" :
            color(0,1,0)
            Shape02.
        else :
            color(0,0,1)
            Shape03.
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  3. #3
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Wow! Thank you! This was a huge help, I had some code right and some wrong. I'll let you know if I have any more trouble! Thank you!

  4. #4
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attributes

    Here is my code

    attr zoning =
    case zoning == "01" :
    color (#f26522)
    case zoning == "02" :
    color (#f30034)
    else :

    The else is throwing an exception, what am I missing? Thanks for your help.

  5. #5
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attributes

    Quote Originally Posted by jdonnelly1982 View Post
    Here is my code

    attr zoning =
    case zoning == "01" :
    color (#f26522)
    case zoning == "02" :
    color (#f30034)
    else :

    The else is throwing an exception, what am I missing? Thanks for your help.

    hahaha, Nevermind I figured it out. Total learning experience.

    This is my code now
    attr zoning = ""

    Lot -->
    case zoning == "01" :
    color ("#f26522")
    case zoning == "02" :
    color ("#f30034")
    else : NIL


    I think my color codes are wrong because none of the parcels changed color, I'm not sure where or why I picked up a hexcolor code.
    Now if I want to go ahead and create the buildings for each parcel I can just do it like this:

    attr zoning = ""

    Lot -->
    case zoning == "01" :
    color ("#f26522")
    Extrude =
    Etc
    Etc
    case zoning == "02" :
    color ("#f30034")
    Etc
    Etc
    else : NIL

    Is this correct? I can just write the rules for each attribute under each case: attribute ???

  6. #6
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    I changed to another attribute to better clarify what that zoning is rather than just using a number as before, I had 3 zoning descriptors. I think I'm all good there but my parcels are not changing color. When I look at the actual parcels that should be affected they ahve the rule applied to them, but the "Value" is blank, i can type in it. Does the color only change if I extrude?

    attr ZONING_1 = ""

    Lot -->
    case ZONING_1 == "RURAL" :
    color ("#ff3300")
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#CC0033")
    else : NIL

  7. #7
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    I changed to another attribute to better clarify what that zoning is rather than just using a number as before, I had 3 zoning descriptors. I think I'm all good there but my parcels are not changing color. When I look at the actual parcels that should be affected they ahve the rule applied to them, but the "Value" is blank, i can type in it. Does the color only change if I extrude?

    attr ZONING_1 = ""

    Lot -->
    case ZONING_1 == "RURAL" :
    color ("#ff3300")
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#CC0033")
    else : NIL

  8. #8
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Stuck for real now

    attr ZONING_1 = "01"

    Lot -->
    case ZONING_1 == "RURAL" :
    color ("#56,193,55")
    Shape01.
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#205,235,241")
    Shape02.
    else : NIL
    Shape03.


    This is my code right now, no errors so that's good. Problem is, nothing is changing colors, I tried extrusions and nothing came up. So there must be something wrong with mmy " ZONING_1 " reference. IDK if anyone can help here. My rule paremeters shows ZONING_1 so it be referrring to the rule, but there's no "value" listed, it's just an empty box to type in. I'm confused.

    Thanks to anyone that can help.

  9. #9
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    hi Jose,


    is your attribute actually pointing to the right source ?

    does it say in the Inspector :
    ZONING_1 "" (Rule) ?

    if this is the case, you have to point the value to the object attr instead of using the rule value.
    use the connection editor button in the Inspector (white rectangle with black triangle) and connect to the object attr.


    let me know ..
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  10. #10
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    I am not seeing the triangle-rectangle shape. I have looked all over. Click image for larger version

Name:	CityEngineHelp.jpg
Views:	41
Size:	255.0 KB
ID:	11977

  11. #11
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Quote Originally Posted by matthiasbuehler View Post
    hi Jose,


    is your attribute actually pointing to the right source ?

    does it say in the Inspector :
    ZONING_1 "" (Rule) ?

    if this is the case, you have to point the value to the object attr instead of using the rule value.
    use the connection editor button in the Inspector (white rectangle with black triangle) and connect to the object attr.


    let me know ..

    I don't have the Connection Editor button, or at least I can't find it. However, in the Inspector there is the Rule Parameter Bar, below that shows "Zoning_1" coming from my rule I assume. The "Source" was a '?' and now I changed it to "Object" and the "Value" is "Rural" in the appropriate parcels and "Mixed Economic Development" in the appropriate parcels.

    I also changed my rule so now it's


    attr ZONING_1 = ""

    Lot -->
    case ZONING_1 == "RURAL" :
    color("#56,193,55")
    Shape01.
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color("#205,235,241")
    Shape02.
    else : NIL
    Shape03.

    Nothing changed, no colors changed.
    What did I miss?
    Last edited by jdonnelly1982; 02-15-2012 at 07:21 PM.

  12. #12
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    1

    Default Re: Create Layer of Attribedutes

    ah, I see what the issue is :

    you are using 2010.3, the old version which has an other Inspectore. We've changed this in the new version !

    first of all, make sure your cga rule file is assigned to the shapes. use the Rule File browse button to assign a rule file to the shapes.

    secondly, change the attribute SOURCE from RULE to OBJECT ATTRIBUTE in the Inspector for all shapes.


    let me know if this works !
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  13. #13
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    1

    Default Re: Create Layer of Attribedutes

    oh, and important :

    in the color operation, use hex colors, not RGB like this.

    eg. red is :
    "#ff0000"
    ( this has also changed for good in the 2011 version. )

    btw. in general, I'd recommend you update to the newest version. there's one coming up right now : 2011.2 !

    greetings !
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  14. #14
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Thank you Matthias,

    The parcel's are still not changing color. I have 2 theories:

    1. The rule says to change to #00C957 (emerald green), but what is supposed to change color? The parcel? the boundary of the parcel? I think the rule is missing some direction what to change, but I could be wrong.

    Maybe I need to build some height into each parcel and then the color will change?

    2. Second idea is there is supposed to be something between the quotes in the attr ZONING_1= "" line, like below. . .

    attr ZONING_1 = ""

    Lot -->
    case ZONING_1 == "rural" :
    color ("#00C957")


    I owe you an incredible amount of appreciation. Thank you!

  15. #15
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    hi !

    did you check the log for any input on what may be wrong ?


    maybe start off very simple, without any linking of stuff.

    does this work :

    Lot -->
    extrude(10)
    color(#"ff0000")
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  16. #16
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Thanks again. I tried what you said and all the parcels turned the color I inputed and the height of all increased 10 feet. I am going to try tinkering around with this some more but if you have the next step then I would appreciate it. You suggested something about "string" in one of your earlier posts to help me. Is that part of my problem?

  17. #17
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Wow, it's all working now. Thank you so much for getting me and my project to this point. The rule file is correctly linked, the parcels have their corresponding colors and I'm starting the next phase which is to build the buildings. I'm looking at others threads and watching the videos, which is helping.

    I have added the attribute for stories and the extrude function. There's no errors but when I generate, nothing happens. The color is there but nothing extrudes.

    attr ZONING_1 = ""
    attr STORIES = ""

    Lot -->
    case ZONING_1 == "RURAL" :
    color ("#00C957")
    case STORIES == "1" :
    extrude(10)
    case STORIES == "2" :
    extrude(20)
    Shape01.
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#00611C")
    case STORIES == "1" :
    extrude(10)
    case STORIES == "2" :
    extrude(20)
    Shape02.


    Or should I separate the extrusion from the coloring of the parcels. Like this?:

    attr ZONING_1 = ""
    attr STORIES = ""

    Lot -->

    case STORIES == "1" :
    extrude(10)
    case STORIES == "2" :
    extrude(20)

    case ZONING_1 == "RURAL" :
    color ("#00C957")
    Shape01.
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#00611C")
    Shape02.


    I have more things to add like setback's, rooves and other things. I am just wondering what the best way to write this script.

  18. #18
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    hi !

    to close 'case' statements, you always need an else at the end to have it work properly.

    CGA code can not be executed unless you have no more red error bars on the side of the CGA editor.


    coloring and extruding can easily be combined together. that should not be the issue.


    let me know if it works ..

    matt
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  19. 03-01-2012 10:00 AM


  20. 03-01-2012 12:14 PM


  21. #19
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    Matthias, I have learned so much in the last few weeks, so thank you! You've helped without doing the project for me and it's much appreciated. I've deleted my last two posts because I figured out the exceptions that my script was throwing.

    So I've been trying on and off all day on stuff, now I've gotten to the point where my linking between the Stories attribute and the Stories Case statements exist. When they're linked, and I change the SOURCE from Rule to Object, the value in the stories attribute disappears from my attributes table and there's no extrusion in the scene. It's got to be a scripting problem.

    attr Stories = ""
    attr ZONING_1 = ""

    Lot-->
    case ZONING_1 == "RURAL" :
    color ("#00C957")
    Shape01.
    case ZONING_1 == "MIXED ECONOMIC DEVELOPMENT" :
    color ("#00611C")
    Shape02.
    case ZONING_1 == "CORE RESIDENTIAL" :
    color ("#C82536")
    Shape03.
    case ZONING_1 == "RES A" :
    color ("#CD5B45")
    Shape04.
    case ZONING_1 == "RES B" :
    color ("#C73F17")
    Shape05.
    case ZONING_1 == "INDUSTRIAL" :
    color ("#C77826")
    Shape06.
    case ZONING_1 == "RURAL LIGHT INDUSTRIAL" :
    color ("#C8F526")
    Shape07.
    case ZONING_1 == "PDD" :
    color ("#CAFF70")
    Shape08.
    case ZONING_1 == "RURAL HAMLET" :
    color ("#CC4E5C")
    Shape09.
    case ZONING_1 == "RESIDENTIAL LARGE LOT" :
    color ("#CC1100")
    Shape10.
    case ZONING_1 == "HAMLET" :
    color ("#C67171")
    Shape11.
    case ZONING_1 == "COMMERCIAL HAMLET" :
    color ("#CC00FF")
    Shape12.
    case ZONING_1 == "RIVERFRONT RURAL" :
    color ("#00FFAA")
    Shape13.
    case ZONING_1 == "COMMERCIAL" :
    color ("#008B45")
    Shape14.
    case ZONING_1 == "RES C" :
    color ("#C82536")
    extrude(20)
    Shape15.
    case ZONING_1 == "MULTI-FAMILY" :
    color ("#C71585")
    Shape16.

    case Stories == "1" : extrude(10)
    case Stories == "2" : extrude(20)
    case Stories == "3" : extrude(30)
    else : NIL

  22. #20
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    hi !

    can it be that Stories is a float value and not a string ?

    5 is not "5"

    maybe try it without the " ..

    let me know ..
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  23. #21
    jose donnelly
    Join Date
    Feb 2012
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Create Layer of Attribedutes

    No, that didn't work. I removed the quotes, and it threw an exception, "No such function:bool ==(a:str,b:float)".

  24. #22
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Create Layer of Attribedutes

    did you also adapt the attr ?

    attr Stories = "" would be wrong in this context ..


    attr Stories = 0
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts