{"id":494,"date":"2012-03-01T14:14:03","date_gmt":"2012-03-01T14:14:03","guid":{"rendered":"http:\/\/www.geoplanit.co.uk\/?p=494"},"modified":"2012-03-01T14:20:05","modified_gmt":"2012-03-01T14:20:05","slug":"creating-a-city-from-gis-data-transport-infrastructure-part-2","status":"publish","type":"post","link":"https:\/\/www.geoplanit.co.uk\/?p=494","title":{"rendered":"Creating a City from GIS data \u2013 Transport Infrastructure \u2013 Part 2"},"content":{"rendered":"<p><strong><a href=\"https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2012\/03\/ce_transport_infrastructure2.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-501 alignright\" title=\"Transport Infrastructure with Lamps and Trees\" src=\"https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2012\/03\/ce_transport_infrastructure2.jpg?resize=263%2C210\" alt=\"\" width=\"263\" height=\"210\" \/><\/a><a href=\"http:\/\/forums.arcgis.com\/threads\/51652-Creating-a-City-from-GIS-data-Transport-Infrastructure\" target=\"_blank\">This is duplicate post of a discussion I started on ESRI\u2019s CityEngine support forum<\/a><\/strong><\/p>\n<p>The next part of this thread is to start a simple road CGA rule file that can take into account the road classification field. This code is based in part on the tutorial examples given by CityEngine but I&#8217;ve modified them for the purpose of this discussion (with myself). The principles here can be applied for many rule sets not just road networks.<\/p>\n<p>This CGA rule will create different looking roads depending on the road classification and place a lamp post at regular intervals on designated streets. I&#8217;ve also added a rule for a covered market street but this is to be added manually in CityEngine.<\/p>\n<p>Road classes are taken from the Streetnetwork&#8217;s &#8220;layer attribbutes&#8221; with code code like this : attr roadClass = getObjectAttr(&#8220;ROADCLASS_FIELDNAME_FROM_GIS&#8221;)<\/p>\n<p>&nbsp;<\/p>\n<pre>const lamp_asset = \"lamppost.obj\" \/\/ this is under your assets directory you can get a quick model from places like Google 3D Warehouse just be sure you have permission to use them!\r\nattr sidewalkHeight =0.25\r\nattr lampDistance =25 \/\/ you could change this or add different attributes for each road class\r\nattr roadClass = \"None\" \/\/ attribute name declared in layer attribute \r\n\r\nStreet--&gt; \/\/ I've coloured these in simple primary colours so you can see what's happening\r\n\tcase roadClass == \"Primary\" : color (\"#ff0000\")\r\n\tcase roadClass == \"Secondary\" : color (\"#00ff00\")\r\n\tcase roadClass == \"Tertiary\" : color (\"#0000ff\") \/\/ you can add more classes here\r\n\telse : color(\"#535353\")\r\n\r\nSidewalk--&gt;\r\n\tset(trim.vertical,false) set(trim.horizontal,false)\r\n\tcomp(f){ all: SidewalkPart }\r\n\r\nSidewalkPart --&gt;\r\n\tcase scope.sx &gt; 5:\r\n\t\tSidewalkWithCurbs\r\n\t\talignScopeToAxes(y) t(0,sidewalkHeight,0)\r\n\t\tSidewalkLampTest\r\n\telse:\r\n\t\tSidewalkWithCurbs\r\n\r\nSidewalkWithCurbs --&gt;\r\n\textrude(world.y,sidewalkHeight)\r\n\tcomp(f)\r\n\t\t{ top   : split(y){ sidewalkHeight : Curbs | ~1 : Pavement }\r\n\t\t| front : Curbs }\r\n\r\nSidewalkLampTest--&gt; \/\/ in this example only my primary and secondary classes of street get lampposts!\r\n\tcase roadClass == \"Primary\" : SidewalkLamps\r\n\tcase roadClass == \"Secondary\" : SidewalkLamps\r\n\telse : nil \r\n\r\nSidewalkLamps --&gt;\r\n\tsplit(x){ ~lampDistance :  NIL\r\n\t\t| { 0.1: Lamp | ~lampDistance : NIL }* }\r\n\r\nPavement --&gt;\r\n\tcolor(\"#C0C0C0\")\r\n\r\nLamp --&gt;\r\n\tt(0,0,scope.sz-sidewalkHeight*2)\r\n\ts(0,5,0)\r\n\tr(0,90,0)\r\n\ti(lamp_asset)\r\n\r\nCurbs --&gt;\r\n\tcolor(\"#C0C0C0\")\r\n\r\nCrossing--&gt;\r\n\tcolor(\"#535353\")\r\n\r\nJunction--&gt;\r\n\tcolor(\"#535353\")\r\n\r\nJunctionEntry--&gt;\r\n\tcolor(\"#535353\")\r\n\r\nIsland--&gt;\r\n\textrude(0.5) color(\"#008000\")\r\n\r\nStreetMarketRoof--&gt; \/\/ you need to select the shapes start rule manually to enable this but you could do it via road class as well\r\n\t   extrude(10) comp(f) {  bottom : marketstreet | top : marketroof  } \r\n\r\nmarketroof--&gt; roofGable(22.5)\r\nmarketstreet --&gt;  reverseNormals color(\"#008000\") \/\/ I seem to need to do this so I can have a coloured street under my marketroof<\/pre>\n<p><strong>Has anyone got anything else to add or correct? Can someone provide code for a nice simple bridge?<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is duplicate post of a discussion I started on ESRI\u2019s CityEngine support forum The next part of this thread is to start a simple road CGA rule file that can take into account the road classification field. This code is based in part on the tutorial examples given by CityEngine but I&#8217;ve modified them [&hellip;]<\/p>\n","protected":false},"author":161,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,116,145,7,54,9],"tags":[],"class_list":["post-494","post","type-post","status-publish","format-standard","category-arcgis","category-city-creation","category-cityengine","category-gis","category-tips","category-workflow"],"_links":{"self":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/users\/161"}],"replies":[{"embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=494"}],"version-history":[{"count":4,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions"}],"predecessor-version":[{"id":496,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions\/496"}],"wp:attachment":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}