{"id":861,"date":"2013-02-08T15:37:32","date_gmt":"2013-02-08T15:37:32","guid":{"rendered":"http:\/\/www.geoplanit.co.uk\/?p=861"},"modified":"2013-02-08T15:39:26","modified_gmt":"2013-02-08T15:39:26","slug":"cityengine-os-opendata-forestry-rule-file-part-2","status":"publish","type":"post","link":"https:\/\/www.geoplanit.co.uk\/?p=861","title":{"rendered":"CityEngine + OS Opendata + Forestry Rule file Part 2"},"content":{"rendered":"<p>Okay this is a modification of <a href=\"http:\/\/www.geoplanit.co.uk\/?p=778\" target=\"_blank\">this previous rule file<\/a> it&#8217;s been one of my more popular posts in recent weeks.<\/p>\n<figure id=\"attachment_862\" aria-describedby=\"caption-attachment-862\" style=\"width: 614px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.geoplanit.co.uk\/?attachment_id=862\" rel=\"attachment wp-att-862\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-862\" alt=\"ce_forest_height_soils\" src=\"https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2013\/02\/ce_forest_height_soils.jpg?resize=614%2C362\" width=\"614\" height=\"362\" srcset=\"https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2013\/02\/ce_forest_height_soils.jpg?resize=1024%2C604&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2013\/02\/ce_forest_height_soils.jpg?resize=300%2C177&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2013\/02\/ce_forest_height_soils.jpg?w=1705&amp;ssl=1 1705w, https:\/\/i0.wp.com\/www.geoplanit.co.uk\/wp-content\/uploads\/2013\/02\/ce_forest_height_soils.jpg?w=1392 1392w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/a><figcaption id=\"caption-attachment-862\" class=\"wp-caption-text\">Forest coloured by elevation range and tree heights by underlying geology layer<\/figcaption><\/figure>\n<p>So as the caption says I&#8217;ve used to methods to control colour and height of trees. \u00a0Using the scatter function I place my tree and then colour via an elevation test and scale via a brightness test on some geology data.<\/p>\n<p>Tree density is controlled by a tree per square metre variable.<\/p>\n<p>Not wishing to put the whole rule out there, here are the relevant tests, if you know anything about CityEngine you&#8217;ll probably tell me there&#8217;s another way&#8230;<br \/>\n<code><br \/>\nattr colourbyelevation = \/\/test by heighest first &gt; greater than xxx metres<br \/>\ncase convert(y,pivot,world,pos,scope.sx,scope.sy,scope.sz) &gt; 350 : \"#ff0000\"<br \/>\ncase convert(y,pivot,world,pos,scope.sx,scope.sy,scope.sz) &gt; 330 : \"#ffff00\"<br \/>\ncase convert(y,pivot,world,pos,scope.sx,scope.sy,scope.sz) &gt; 330 : \"#00ff00\"<br \/>\ncase convert(y,pivot,world,pos,scope.sx,scope.sy,scope.sz) &gt; 300 : \"#00ffff\"<br \/>\ncase convert(y,pivot,world,pos,scope.sx,scope.sy,scope.sz) &gt; 0 : \"#0000ff\"<br \/>\nelse : \"#00000\"<br \/>\nattr treehegeotypeightbygeology =<br \/>\ncase GeoType &gt; 0 : 50<br \/>\nelse : 25<br \/>\n<\/code><br \/>\n<strong>The beauty of CityEngine is apparent when you realise this doesn&#8217;t have to be trees or elevations or geology<\/strong>, and you can combine these tests with other rules to make something truly complicated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Okay this is a modification of this previous rule file it&#8217;s been one of my more popular posts in recent weeks. So as the caption says I&#8217;ve used to methods to control colour and height of trees. \u00a0Using the scatter function I place my tree and then colour via an elevation test and scale via [&hellip;]<\/p>\n","protected":false},"author":161,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[145,222,54,9],"tags":[],"class_list":["post-861","post","type-post","status-publish","format-standard","category-cityengine","category-forestry","category-tips","category-workflow"],"_links":{"self":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/861","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=861"}],"version-history":[{"count":3,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/861\/revisions"}],"predecessor-version":[{"id":864,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/861\/revisions\/864"}],"wp:attachment":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}