Patrik
Patrik

Reputation: 31

Overpass API - filter out non-empty tags

Following on from this question, I am trying to query the Overpass API so that it returns all nodes with tags "natural" and "historic" where tag "name" is not emtpy around a set of coordinates with radius 1500m

What I have so far is

<union>
    <query type="node">
        <around radius="1500" lat="51.1263041473" lon="1.3268128927"/>
        <has-kv k="historic"/>
    </query>
    <query type="node">
        <around radius="1500" lat="51.1263041473" lon="1.3268128927"/>
        <has-kv k="natural"/>
    </query>
</union>
<print/>

This works for both keywords, but doesn't cater for tag "name" not being empty (see: Overpass Turbo)

How can I filter out any node with tag "name" not emtpy?

Upvotes: 1

Views: 1345

Answers (1)

Patrik
Patrik

Reputation: 31

Hmm, I just found the answer - I didn't know how to put regex into the query. Now I do:

<union>
<query type="node">
    <around radius="1500" lat="51.1263041473" lon="1.3268128927"/>
    <has-kv k="historic"/>
    <has-kv k="name" regv=".+"/>      
</query>
<query type="node">
    <around radius="1500" lat="51.1263041473" lon="1.3268128927"/>
    <has-kv k="natural"/>
    <has-kv k="name" regv=".+"/>
</query>

Upvotes: 0

Related Questions