vectorpipe icon indicating copy to clipboard operation
vectorpipe copied to clipboard

Create helpers for isSomething while supporting multi-valued tags

Open sethfitz opened this issue 7 years ago • 0 comments

Right now, boilerplate looks like:

  def isForest(tags: Column): Column =
    array_contains(splitDelimitedValues(tags.getItem("landuse")), "forest") as 'isForest

Let's see if we can fold up the array_contains and splitDelimitedValues to avoid mistakes when creating new functions.

This may make it easier to implement complex checks like:

  def isLake(tags: Column): Column =
    (array_contains(splitDelimitedValues(tags.getItem("natural")), "water") and
     (tags("water").isNull or
      not(array_contains(splitDelimitedValues(tags.getItem("water")), "river") or
          array_contains(splitDelimitedValues(tags.getItem("water")), "canal")
         )
     )
    ) as 'isLake

sethfitz avatar Aug 07 '19 20:08 sethfitz