Simplistic overpass-turbo in cartes.app

Hi,
I wanted to share a tip for OSM contributors we’ve added recently to cartes.app, which lets you run simplistic Overpass queries, and get a map as in overpass-turbo.
It only works for requests like nwr[your tag filters]({{bbox}}); but I think it’s actually quite a frequent case.
Just type the tag filters in the search bar, and it will create a custom category:

The request is stored in your browser, so if you come back later, just type overpass in the search bar to find this custom category and re-activate it:

(It only works in English, French and Spanish since our categories are not translated in other languages yet. We plan to use the iD tagging schema for this.)

2 Likes

Dear @PlayGuide

I wanted to share a tip for OSM contributors we’ve added recently to cartes.app, which lets you run simplistic Overpass queries, and get a map as in overpass-turbo.

Very nice feature! Is there a documentation of the syntax allowed?

This very much reminds me of the “overpass-style” of the Pyrosm filter (and also OSMNX).

I actually wanted to open an issue on the codeberg git repo, but could not find the Pull-Request nor the issue. See below my proposals for a syntax.

-- Stefan

Proposed Filter Query Syntax “overpass-style”:

  • ["highway"]: Key exists
  • [!"highway"]: Key does not exist
  • ["highway"="primary"]: Equality
  • ["highway"!="primary"]: Inequality (also matches objects without the key)
  • ["name"~"Rapperswil",i]: Regex, case-insensitive
  • ["name"!~"Rapperswil"]: Negated regex (also matches objects without the key)
  • ["cuisine"~"italian|pizza"]: Regex: value contains one of the terms (also matches lists such as italian;pizza)
  • ["amenity"="cafe"]["wifi"="yes"]: AND: filters in sequence
  • ["amenity"="cafe"] || ["shop"="bakery"]: OR between filters (custom notation, translated into a union)

Remarks:

  • On != and !~: Negated conditions are also satisfied when the key is absent. ["highway"!="primary"] therefore also returns objects that have no highway tag at all. To restrict the result to objects with the key, combine it with a positive condition: ["highway"]["highway"!="primary"].
  • On multi-valued tags: OSM stores multiple values in a single tag separated by semicolons, e.g. cuisine=italian;pizza. Since a regex is a substring match, ["cuisine"~"italian|pizza"] also matches such lists.
  • On ||: This is a custom notation and not valid Overpass QL. It is translated into a union internally. AND binds more tightly than OR, and there is no nesting. Every filter expression is thus an OR of AND groups (disjunctive normal form).
  • Positive condition: Every AND group must contain at least one positive condition (key exists, = or ~). [!"highway"] on its own is therefore not allowed, whereas ["amenity"="cafe"][!"wifi"] is.
  • Regex: A regex is a substring match. Key regex ([~"k"~"v"]) is not supported, because the key is then not fixed and every key of every element would have to be checked.
  • General: Tag values are strings. Tag filters do not support greater-than/less-than comparisons. The ,i option (case-insensitive) is only available with the regex operators ~ and !~, not with =.

We do not interpret the text to build a request on a dedicated DB. The text [filters] is used as it stands in the Overpass query nwr[filters]({{bbox}}); on our private Overpass instance. So the allowed syntax is all the overpass query language syntax for tag filters.

The only difference is that our instance uses @mmd 's fork, so you can use a few additionnal syntaxes described here.

The PR was here. It’s true that we have a bad habit of using too much French in our issues… Feel free to create new issues in English, it really isn’t a problem, and we will link it to the other relevant issues.

Thank you for this detailed list, but this feature is more like an easter-egg for regular OSM users. We won’t show such a list to standard cartes.app users, as it would probably put them off! :sweat_smile:

2 Likes