NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I've just discovered an amazing tool - the Query Wizard for Overpass Turbo. I think it's pretty new and it is absolutely awesome. I created a complex query in only few minutes of trial and error that returns all towns, villages, and hamlets that a) do not have a "name:en=*" tag and b) the name tag they do have contains no English characters. The query is:

(place=village or place=hamlet or place=town) and ("name:en"!=* and name!="[a-z]")

The query generated by the Wizard is much, much more complicated. It's fair to say that, although I do have some programming experience, I might never have put it together on my own.

My primary goal at the moment is to find all place names in my area of interest (Thailand) in order to add a name:en tag to supplement the existing name tag, which is typically in Thai and therefore unreadable by my Garmin software or GPS.

The query works well but I'm looking for a way to send those nodes and ways to JOSM (or somewhere else) so I can edit them in a single session. Right now I can only edit them one at a time using the Lat/Lon tool in JOSM which is both tedious and slow. I'm not looking for an automatic edit, only a method that makes it easier to jump from node to node (town to town), editing as I go.

Anybody not familiar with the new Overpass Query Wizard should definitely take the time to check it out. It's accessible from the home screen on Overpass Turbo

Thanks in advance for your help...

Dave

asked 13 Dec '13, 04:13

AlaskaDave's gravatar image

AlaskaDave
5.4k76107164
accept rate: 16%

1

If you want to use a regex, you should use a ~ instead of =. In your query it would then look like the following:

… and name!~"[a-z]")

read more about the Wizard on my recent diary post or the wiki

(13 Dec '13, 08:34) tyr_asd

Thanks for your answer.

The Wizard apparently interprets the "=" as "~" because it generates this statement: <has-kv k="name" modv="not" regv="[a-z]"/>

I'll take a look at your post.

(13 Dec '13, 10:05) AlaskaDave

The Wizard apparently interprets the "=" as "~"

Hmm. Actually, it shouldn't. What browser are you on?

(14 Dec '13, 10:23) tyr_asd

I am using Chrome. But, I may have misspoke above. I looked at the generated code and saw regv statements in it and assumed it was equating the two symbols.

In fact, the query always times out if the "=" is replaced with a "~" so they're obviously not equivalent.

While I've got your attention, tyr_asd, can you tell me quickly how to restrict the queries to only nodes and ways?

(14 Dec '13, 10:54) AlaskaDave
1

To restrict to certain OSM datatypes just add something like: … and (type:node or type:way).

And yes, the Overpass API seems to be quite slow for negated regex queries of the name tag. I'm not sure why this is, but for your use-case I'd you can use the following regex instead: … name~/[^a-z]/i …

Your complete example would then be: (place=village or place=hamlet or place=town) and ("name:en"!=* and name~/[^a-z]/i) and (type:node or type:way)

(14 Dec '13, 18:58) tyr_asd

Okay, thanks for that. Your new, revised query runs fast and works well.

One last question, I promise. How would I search for highway ref tags that do not contain a "." The following query works but not consistently; it sometimes returns refs that contain a "." I can't understand how that could be. Here is my query:

highway=tertiary and type:way and ref!~"/."

Many thanks in advance...

(15 Dec '13, 01:30) AlaskaDave

try: highway=tertiary and type:way and ref!~"[.]"

(15 Dec '13, 16:38) tyr_asd

Absolutely amazing. What a difference a bracket makes! Thanks again for all your help on this problem. I've learned a ton and the query will assist me to clean up some issues with improperly constructed refs here in Thailand.

(15 Dec '13, 23:38) AlaskaDave
showing 5 of 8 show 3 more comments

To elaborate Dymo12's answer further:

First, get from Overpass Turbo an editable OSM file:

  1. Ensure that all output statements ("out" in QL, "print" in XML) of the query are set to meta mode. Replace for that purpose "out;" with "out meta;" or '< print />' with '< print mode="meta" >'.
  2. Run the query
  3. Choose "Export > Raw data"
  4. Use you browser's menu to store the result to disk ("File > Save as ...") or similar.

Now, configure JOSM to faciliate editing sparse objects:

  1. Choose "Edit > Preferences > WMS TMS", select in "Available default entries" the line "OpenStreetMap (Mapnik Black and White)" and click "Activate", then "OK". This enables to see the Mapnik base map in the background without loading all objects.
  2. Choose "Imagery > OpenStreetMap (Mapnik Black and White)" to turn the background layer on.
  3. Use "File > Open ..." to load the previously saved file.
  4. Do whatever edits you deem suitable. Please keep in mind that there might be objects hidden, because they are neither rendered nor contained in your query.
  5. Upload the result in the well-known way.
permanent link

answered 13 Dec '13, 07:52

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

@Roland - That helped a lot. I could not get JOSM to open the "raw" exported .JSON file so next I tried exporting the data as GPX. I was able to open that in JOSM with the Mapnik layer which worked fine except every time I tried to edit a point, it opened an OSM page in my browser. That's when I decided to download a little screenful of OSM data around each town in JOSM

Then I "J"umped from one marker to the next, only downloading a tiny window of OSM data at each one, and doing my editing.

I'm still doing something wrong, but at least I can do my edits in a much less labor intensive manner.

(13 Dec '13, 10:41) AlaskaDave

Aaah, now with the print statement in the query changed to "meta" I can send the data directly to JOSM.

Too cool.

(13 Dec '13, 10:48) AlaskaDave

The revised query worked fine yesterday but now it fails because of a timeout. I removed the sections that query relations to reduce the time it takes to do the query but it still fails even for very small bounding boxes.

Any ideas? Post a new question?

(14 Dec '13, 00:11) AlaskaDave

Just increase the timeout parameter at the begin of the query. (something like timeout="300" should do the trick).

Btw: If you use the load into JOSM tool from the Export dialogue, overpass turbo automatically revises your query such that its results will be suitable as JOSM input.

(14 Dec '13, 10:28) tyr_asd

Yes, thanks. The Auto repair function is fantastic. And afterward the output goes directly to JOSM, which is just what I wanted.

I discovered the timeout parameter on my own but I searched for info about it with Google and came up empty. Maybe adjusting timeout values should be mentioned in the Wiki?

(15 Dec '13, 04:19) AlaskaDave

I also think Overpass Turbo is amazingly cool, actually so cool that it also have an export function that can send the result directly to JOSM via remote control and it will even fix your query to return data in the correct format.

You can then use the todo plugin in JOSM to go through the result.

permanent link

answered 13 Dec '13, 05:01

Dymo12's gravatar image

Dymo12
79611016
accept rate: 12%

That's the question. I'm asking, "how can I send that output to JOSM?" I've tried some Export options (while JOSM is running with Remote Contol enabled) but I cannot see the target nodes in JOSM.

(13 Dec '13, 07:23) AlaskaDave
1

@AlaskaDave: Well, as I understand it the Wizard just does the task of writing the code for you. Nothing special then.

Just use the Export (a button on top) → "load into JOSM" function, accept the auto-repair, and try again. That usually works for me with my queries. And it does with your query via the Wizard (tested).

(13 Dec '13, 07:36) aseerel4c26 ♦

The Overpass API with Query wizard is now integrated into JOSM. See https://josm.openstreetmap.de/wiki/Help/Action/OverpassDownload

permanent link

answered 13 Oct '18, 17:13

pangoSE's gravatar image

pangoSE
3111
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622
×483
×147
×4

question asked: 13 Dec '13, 04:13

question was seen: 16,090 times

last updated: 13 Oct '18, 17:13

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum