Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12469 closed enhancement (fixed)

update overpass wizard code

Reported by: tyr_asd Owned by: simon04
Priority: normal Milestone: 16.02
Component: Core Version:
Keywords: Cc:

Description (last modified by Don-vip)

The overpass wizard (javascript) code used in JOSM's Download from Overpass API utility should be updated to use the recently published standalone module: https://github.com/tyrasd/overpass-wizard.

The new module has a couple of options which modify the output of the wizard. So, it can be set up to produce a query with recursive meta output, xml format and the global bbox parameter set (see https://github.com/drolbr/Overpass-API/issues/251). You could even supply your own set of presets which would be searched for free-form input, but I'd still call that feature as experimental for now.

The module doesn't come in a standalone js file (but as a node module), but you can generate one by passing it through browserify (resulting in a 28kB script after minification):

browserify -s overpassWizard index.js | uglifyjs > overpass-wizard.js

Attachments (0)

Change History (9)

comment:1 Changed 3 years ago by simon04

Cc: simon04 removed
Milestone: 16.02
Owner: set to simon04
Priority: minornormal

comment:2 Changed 3 years ago by simon04

Resolution: fixed
Status: newclosed

In 9704/josm:

fix #12469 - Update overpass wizard code

comment:4 Changed 3 years ago by Klumbumbus

Resolution: fixed
Status: reopenedclosed

test is skipped since r9815

comment:5 Changed 3 years ago by simon04

In 9856/josm:

fix #12547 see #12469 - Fix Overpass API "Build query" for Java 7

comment:6 Changed 3 years ago by Don-vip

Description: modified (diff)

comment:7 Changed 3 years ago by Don-vip

It seems queries are not expanded, see #12939.

I have checked that running overpassWizard in the command line results in expanded queries (area(...)), while calling the standalone version from JOSM results in raw queries (geocodeArea:...), rejected by Overpass API.

I assumed the fix would be trivial (include expand.js as follows):

browserify -s overpassWizard index.js expand.js | uglifyjs > overpass-wizard.js

but it does not work better, although the file is much bigger.
I don't know how to solve this.

Simon, tyr_asd, can you please help me?

comment:8 Changed 3 years ago by tyr_asd

Oh, yeah. Let's see. Does your javascript engine support XMLHttpRequest and getting results out from an async js callback? If yes, than you can use the `exand.js` module[¹] that comes with overpass-wizard (even though it's still undocumented – I'll have to work on that, sorry!). Otherwise, you're probably better off re-implementing the necessary shortcut expansion code yourself in Java (you can use expand.js as a reference). I guess that you already have code to send requests to Nominatim, right? In which cast this should only require some glue code here and there. (For other features of the overpass-wizard you should also implement the relative date and constants expansion, though.)

PS: I see that you're currently hardcoding a bbox-query (even for example if the users typed in a global query) by sending the bbox parameter with every Overpass request. Don't forget to rework that as well. ;-)

[¹] probably use browserify -s expand expand.js to generate a separate compiled module.

comment:9 Changed 3 years ago by Don-vip

thanks for your feedback :) I think I will then rewrite the shortcut expansion in Java, as we have everything we need for Nominatim and keeping control on network connections is a better approach for JOSM (we have a lot of centralized stuff for everything network-related).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.