{"id":1552,"date":"2020-05-06T11:43:05","date_gmt":"2020-05-06T11:43:05","guid":{"rendered":"https:\/\/wetransform.eu\/?post_type=news-and-events&#038;p=1552"},"modified":"2022-07-28T08:09:50","modified_gmt":"2022-07-28T08:09:50","slug":"bounding-box-collector","status":"publish","type":"news-and-events","link":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/","title":{"rendered":"Groovy Week 2020: Building a Bounding Box using a Collector"},"content":{"rendered":"<p>In our third installment of the 2020 Groovy Week, we are going to cover a typical use case of hale\u00bbstudio's Collector feature: building a bounding box covering the geometries of all source objects. For an introduction to the powerful Collector feature, make sure to check out <a href=\"\/news-and-events\/tutorial-collectors-halestudio\/\">our previous post on the subject<\/a>. Like in the previous Groovy Week posts, note that this article assumes you have working knowledge of hale\u00bbstudio and know the terminology.<\/p>\n<h2>Wednesday's Script: Building a Bounding Box using a Collector (Florian)<\/h2>\n<p>A typical use case for calculating a bounding box covering the geometries of all source objects is creating an alignment to the <a href=\"https:\/\/inspire.ec.europa.eu\/Themes\/133\/2892\">INSPIRE Species Distribution theme<\/a>. Transforming to this theme typically comprises creating several <code>SpeciesDistributionUnit<\/code> instances and a single <code>SpeciesDistributionDataset<\/code> instance which references those units.<\/p>\n<p>When creating the <code>SpeciesDistributionDataset<\/code> instance, one of the mandatory target attributes to fill is <code>domainExtent<\/code> which should contain the geographic extent of all contained <code>SpeciesDistributionUnit<\/code> instances. To achieve this, we will create a bounding box covering all <code>SpeciesDistributionUnit<\/code> geometries on the fly during the transformation using a Collector. While there exists the specialized function <code>Compute Extent<\/code> for calculating bounding boxes, using it would require a <code>Merge<\/code> over all source instances. Using a Collector is more efficient in this case.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png\" alt=\"hale\u00bbstudio Groovy script mapping of a geometry property\" \/><\/p>\n<p>Instead of using the <code>Rename<\/code> function to map the source geometry to the <code>SpeciesDistributionUnit<\/code>, use the following Groovy script:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/JBoudewijn\/425ee2c4f91d8b93348b5f5a45c79cf2.js\"><\/script><\/p>\n<p>To assign the calculated bounding to the <code>domainExtent<\/code> property of the <code>SpeciesDistributionDataset<\/code> type, use the script below:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/JBoudewijn\/ffea4716684c8cc2635a5ca01064b1d4.js\"><\/script><\/p>\n<p>Make sure to <a href=\"http:\/\/help.halestudio.org\/latest\/topic\/eu.esdihumboldt.hale.doc.user\/html\/concepts\/cell_priority.html?cp=0_3_1_3\">reduce the priority<\/a> of the <code>SpeciesDistributionDataset<\/code> transformation to make sure that it is executed last, i.e. after all <code>SpeciesDistributionUnit<\/code>s are created.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/assign-domainExtent.png\" alt=\"hale\u00bbstudio Groovy script mapping of the extent property\" \/><\/p>\n<p>You can download the script snippets <a href=\"https:\/\/github.com\/wetransform-os\/website-examples\/blob\/af7108ee8f5a838327c3e4b871850212c399e37c\/news\/resources\/collectBoundingBox.groovy\">here<\/a> and <a href=\"https:\/\/github.com\/wetransform-os\/website-examples\/blob\/af7108ee8f5a838327c3e4b871850212c399e37c\/news\/resources\/assignExtent.groovy\">here<\/a> and import them in hale\u00bbstudio as a Groovy snippet by going to File -&gt; Import -&gt; Groovy Snippet. Please note that some scripts use protected functions, so you might need to &quot;Lift Groovy Restrictions&quot; to execute the script. Make sure you replace the placeholder attribute names with your own attribute names.<\/p>\n<p>Happy transforming!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our third installment of the 2020 Groovy Week, we are going to cover a typical use case of hale\u00bbstudio&#8217;s Collector feature: building a bounding box covering the geometries of all source objects. For an introduction to the powerful Collector feature, make sure to check out our previous post on the subject. Like in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[48],"tags":[47,21,46],"class_list":["post-1552","news-and-events","type-news-and-events","status-publish","hentry","category-tutorials","tag-groovy","tag-halestudio","tag-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Groovy Week 2020: Building a Bounding Box using a Collector - wetransform<\/title>\n<meta name=\"description\" content=\"We cover a typical use case of hale\u00bbstudio&#039;s Collector feature: building a bounding box covering the geometries of all source objects.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Groovy Week 2020: Building a Bounding Box using a Collector\" \/>\n<meta property=\"og:description\" content=\"We cover a typical use case of hale\u00bbstudio&#039;s Collector feature: building a bounding box covering the geometries of all source objects.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/\" \/>\n<meta property=\"og:site_name\" content=\"wetransform\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-28T08:09:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wetransformto\" \/>\n<meta name=\"twitter:label1\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/\",\"url\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/\",\"name\":\"Groovy Week 2020: Building a Bounding Box using a Collector - wetransform\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/geometry-groovy-script.png\",\"datePublished\":\"2020-05-06T11:43:05+00:00\",\"dateModified\":\"2022-07-28T08:09:50+00:00\",\"description\":\"We cover a typical use case of hale\u00bbstudio's Collector feature: building a bounding box covering the geometries of all source objects.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/geometry-groovy-script.png\",\"contentUrl\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/geometry-groovy-script.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/bounding-box-collector\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wetransform.to\\\/de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"News & Events\",\"item\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Groovy Week 2020: Building a Bounding Box using a Collector\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#website\",\"url\":\"http:\\\/\\\/wetransform.to\\\/de\\\/\",\"name\":\"wetransform\",\"description\":\"Making environmental data useful and accessible\",\"publisher\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/wetransform.to\\\/de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#organization\",\"name\":\"wetransform\",\"url\":\"http:\\\/\\\/wetransform.to\\\/de\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wetransform.to\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/large-logo-whitebg.png\",\"contentUrl\":\"https:\\\/\\\/wetransform.to\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/large-logo-whitebg.png\",\"width\":1024,\"height\":1024,\"caption\":\"wetransform\"},\"image\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/wetransformto\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wetransform-gmbh\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Groovy Week 2020: Building a Bounding Box using a Collector - wetransform","description":"We cover a typical use case of hale\u00bbstudio's Collector feature: building a bounding box covering the geometries of all source objects.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/","og_locale":"de_DE","og_type":"article","og_title":"Groovy Week 2020: Building a Bounding Box using a Collector","og_description":"We cover a typical use case of hale\u00bbstudio's Collector feature: building a bounding box covering the geometries of all source objects.","og_url":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/","og_site_name":"wetransform","article_modified_time":"2022-07-28T08:09:50+00:00","og_image":[{"url":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@wetransformto","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/","url":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/","name":"Groovy Week 2020: Building a Bounding Box using a Collector - wetransform","isPartOf":{"@id":"http:\/\/wetransform.to\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/#primaryimage"},"image":{"@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/#primaryimage"},"thumbnailUrl":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png","datePublished":"2020-05-06T11:43:05+00:00","dateModified":"2022-07-28T08:09:50+00:00","description":"We cover a typical use case of hale\u00bbstudio's Collector feature: building a bounding box covering the geometries of all source objects.","breadcrumb":{"@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/#primaryimage","url":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png","contentUrl":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/geometry-groovy-script.png"},{"@type":"BreadcrumbList","@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/bounding-box-collector\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wetransform.to\/de\/"},{"@type":"ListItem","position":2,"name":"News & Events","item":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/"},{"@type":"ListItem","position":3,"name":"Groovy Week 2020: Building a Bounding Box using a Collector"}]},{"@type":"WebSite","@id":"http:\/\/wetransform.to\/de\/#website","url":"http:\/\/wetransform.to\/de\/","name":"wetransform","description":"Making environmental data useful and accessible","publisher":{"@id":"http:\/\/wetransform.to\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/wetransform.to\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"http:\/\/wetransform.to\/de\/#organization","name":"wetransform","url":"http:\/\/wetransform.to\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"http:\/\/wetransform.to\/de\/#\/schema\/logo\/image\/","url":"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/07\/large-logo-whitebg.png","contentUrl":"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/07\/large-logo-whitebg.png","width":1024,"height":1024,"caption":"wetransform"},"image":{"@id":"http:\/\/wetransform.to\/de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/wetransformto","https:\/\/www.linkedin.com\/company\/wetransform-gmbh\/"]}]}},"_links":{"self":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events"}],"about":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/types\/news-and-events"}],"author":[{"embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/comments?post=1552"}],"version-history":[{"count":4,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1552\/revisions"}],"predecessor-version":[{"id":3753,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1552\/revisions\/3753"}],"wp:attachment":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/media?parent=1552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/categories?post=1552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/tags?post=1552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}