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:
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
showing 5 of 8
show 3 more comments
|
To elaborate Dymo12's answer further: First, get from Overpass Turbo an editable OSM file:
Now, configure JOSM to faciliate editing sparse objects:
answered 13 Dec '13, 07:52 Roland Olbricht @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 Btw: If you use the
(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. answered 13 Dec '13, 05:01 Dymo12 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 answered 13 Oct '18, 17:13 pangoSE |
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
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.
Hmm. Actually, it shouldn't. What browser are you on?
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?
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)
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...
try:
highway=tertiary and type:way and ref!~"[.]"
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.