{"id":1635,"date":"2018-06-26T15:10:23","date_gmt":"2018-06-26T15:10:23","guid":{"rendered":"https:\/\/wetransform.eu\/?post_type=news-and-events&#038;p=1635"},"modified":"2022-07-28T08:45:56","modified_gmt":"2022-07-28T08:45:56","slug":"groovy-week-spatial-index","status":"publish","type":"news-and-events","link":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/","title":{"rendered":"It&#8217;s Groovy Week: Working with the Spatial Index"},"content":{"rendered":"<p>This is the second installment of our &quot;Groovy week&quot;. This time, we are going to look into a powerful feature in hale\u00bbstudio that is used by the Spatial Join function, but can also be accessed through scripting - the spatial index.<\/p>\n<p>Like the previous post, note that this article assumes you have working knowledge of hale studio and know the <a href=\"http:\/\/help.halestudio.org\/latest\/nav\/0_3\">terminology<\/a>.<\/p>\n<h2>Tuesday's Script: Build Polygons from Lines (Florian)<\/h2>\n<p>We used this script to build up references from boundaries to four levels of administrative units. In the original data, such references were not explicit, with the exception of international borders. <\/p>\n<p>The script first identifies possible candidate <code>AdministrativeUnit<\/code> polygon geometries through the index and then verifies that the boundary object indeed matches the boundary of the polygon. It then constructs references differently, depending on the level of the identified <code>AdministrativeUnit<\/code>. As a result of this script, an <code>AdministrativeBoundary<\/code> target object can have references to up to six <code>AdministrativeUnits<\/code> - if it happens to be a boundary that separates 5th level, 4th level and 2nd level on both sides.<\/p>\n<p>The execution context is in a Groovy Retype function.<\/p>\n<p>This is the full script:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/JBoudewijn\/830435c5cca6e9f5ed026eb5352084ac.js\"><\/script><\/p>\n<p>You can download this script <a href=\"https:\/\/github.com\/wetransform-os\/website-examples\/blob\/af7108ee8f5a838327c3e4b871850212c399e37c\/news\/resources\/spatialReferences.groovy\">here<\/a> and import it in hale studio as a Groovy snippet by going to File -&gt; Import -&gt; Groovy Snippet. Please note that it uses some protected functions, so you need to &quot;Lift Groovy Restrictions&quot; to execute the script. It assumes a certain geometry attribute name (<code>the_geom<\/code>) that you might have to change. The additional attributes accessed here, such as <code>BFS_NUMMER<\/code>, <code>BEZIRKSNUM<\/code>, <code>KANTONSNUM<\/code> and <code>ICC<\/code>, will not be available in your source data.<\/p>\n<p>We have thus included a simpler call to the spatial index as a second example:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/JBoudewijn\/033fbb14fa34ad63830a3633b527e185.js\"><\/script><\/p>\n<p><a href=\"https:\/\/github.com\/wetransform-os\/website-examples\/blob\/af7108ee8f5a838327c3e4b871850212c399e37c\/news\/resources\/spatialIndex.groovy\" title=\"Download\">Download<\/a><\/p>\n<p>Happy transforming!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the second installment of our &quot;Groovy week&quot;. This time, we are going to look into a powerful feature in hale\u00bbstudio that is used by the Spatial Join function, but can also be accessed through scripting &#8211; the spatial index. Like the previous post, note that this article assumes you have working knowledge of [&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-1635","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.3 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>It&#039;s Groovy Week: Working with the Spatial Index - wetransform<\/title>\n<meta name=\"description\" content=\"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.\" \/>\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\/groovy-week-spatial-index\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"It&#039;s Groovy Week: Working with the Spatial Index\" \/>\n<meta property=\"og:description\" content=\"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/\" \/>\n<meta property=\"og:site_name\" content=\"wetransform\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-28T08:45:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/04\/logo-large-e1657284415170.png\" \/>\n\t<meta property=\"og:image:width\" content=\"254\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/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\\\/groovy-week-spatial-index\\\/\",\"url\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/groovy-week-spatial-index\\\/\",\"name\":\"It's Groovy Week: Working with the Spatial Index - wetransform\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#website\"},\"datePublished\":\"2018-06-26T15:10:23+00:00\",\"dateModified\":\"2022-07-28T08:45:56+00:00\",\"description\":\"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/groovy-week-spatial-index\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/groovy-week-spatial-index\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/neuigkeiten-veranstaltungen\\\/groovy-week-spatial-index\\\/#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\":\"It&#8217;s Groovy Week: Working with the Spatial Index\"}]},{\"@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":"It's Groovy Week: Working with the Spatial Index - wetransform","description":"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.","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\/groovy-week-spatial-index\/","og_locale":"de_DE","og_type":"article","og_title":"It's Groovy Week: Working with the Spatial Index","og_description":"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.","og_url":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/","og_site_name":"wetransform","article_modified_time":"2022-07-28T08:45:56+00:00","og_image":[{"width":254,"height":200,"url":"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/04\/logo-large-e1657284415170.png","type":"image\/png"}],"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\/groovy-week-spatial-index\/","url":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/","name":"It's Groovy Week: Working with the Spatial Index - wetransform","isPartOf":{"@id":"http:\/\/wetransform.to\/de\/#website"},"datePublished":"2018-06-26T15:10:23+00:00","dateModified":"2022-07-28T08:45:56+00:00","description":"Groovy scripting is the easiest way to add custom transformation functions to hale\u00bbstudio. Today, we focus on using the spatial index.","breadcrumb":{"@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wetransform.to\/de\/neuigkeiten-veranstaltungen\/groovy-week-spatial-index\/#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":"It&#8217;s Groovy Week: Working with the Spatial Index"}]},{"@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\/1635","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=1635"}],"version-history":[{"count":4,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1635\/revisions"}],"predecessor-version":[{"id":3777,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1635\/revisions\/3777"}],"wp:attachment":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/media?parent=1635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/categories?post=1635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/tags?post=1635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}