geotrellis / vectorpipe

Convert Vector data to VectorTiles with GeoTrellis.
https://geotrellis.github.io/vectorpipe/
Other
74 stars 20 forks source link

Create helpers for isSomething while supporting multi-valued tags #110

Open mojodna opened 5 years ago

mojodna commented 5 years ago

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