This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Overpass: get values with “special” characters

1
1

Hello

I am trying to use a query for retrieving wrong ( abbreviated ) values in keys, for example: places of worship which names beginning with "S."

this is the query

[out:xml]
;
(
  node
    ["name"~"^S\."]
    ["amenity"="place_of_worship"]
    (46.00,12.24,46.70,13.80);
  way
    ["name"~"^S\."]
    ["amenity"="place_of_worship"]
    (46.00,12.24,46.70,13.80); 
);
out meta;
>;
out meta;

This returns ALL the features beginning whith "S", backslash before the dot seems not to work.

Where am I wrong?

Thank You

asked 16 Feb '13, 17:53

gpstracks's gravatar image

gpstracks
51123
accept rate: 0%


One Answer:

7

In Overpass QL you need to escape backslashes: ["name"~"^S\."] results in the regular expression ^S. (which finds every name starting with "S"). By contrast, ["name"~"^S\\."] produces the most likely ment regular expression ^S\. (which finds every name starting with "S.").

answered 18 Feb '13, 08:23

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

2

It works. Thank You

(19 Feb '13, 22:11) gpstracks

Source code available on GitHub .