Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mojodna opened this issue Aug 7, 2019 · 0 comments
Open

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

mojodna opened this issue Aug 7, 2019 · 0 comments

Comments

@mojodna
Copy link
Collaborator

mojodna commented Aug 7, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant