News entry thumbnail
It's Groovy Week: Aggregate MultiLineStrings
27.06.2018 by Thorsten Reitz, Johanna Ott

This is the third time to get “Groovy” this week! Today, we will look into how we can simplify Multi-Geometries to simple geometries using a specific script. This is often necessary when the target data model only allows simple geometries, but we can actually have composite and multi-geometries (MultiLineString, MultiPolygon) in the source data.

Like the previous posts, note that this article assumes you have working knowledge of hale studio and know the terminology.

Wednesday’s Script: Create LineStrings from MultiLineStrings (Johanna)

This Groovy Script was developed to aggregate MultiLineString geometries and convert them to LineStrings.

Background: This script was developed to process the 2018 HY-P Swisstopo data. A merge on the feature type level necessitated the use of aggregation to obtain one LineString per feature. The script below was used in a Greedy Groovy script function on the geometry property.

This script also contains a lot of great logging examples!

This is the full script:



You can download this script here and import it in hale studio as a Groovy snippet by going to File -> Import -> Groovy Snippet. It assumes a certain geometry attribute name (the_geom) that you might have to change.

Happy transforming!