openstreetmap-website icon indicating copy to clipboard operation
openstreetmap-website copied to clipboard

Local site navigation

Open lectrician1 opened this issue 5 years ago • 5 comments

Initial Problem Currently, the Query features tool/page has no ability to navigate back to the Query Features list without re-requesting the site/Overpass-API.

Example Untitled_ Nov 21, 2020 7_32 PM

Explanation Here, I query a point and click on an element. Then, I have to use the back-button for my browser to go back to the query list. Of course, this re-requests osm.org and in-turn, Overpass.

Reasoning & Request Sometimes I like to look at and browse a lot of elements (especially in element-dense cities) using the query tool. After I look at an element, I want to be able to go back to the link fast, without having to wait for the web page to reload. A dedicated back button that leads back to the Query page would do this.

Other Uses Other left-pane-using pages on the site could also use this functionality. For example, after viewing a changed element on a Changeset page, you should be able to easily go back to the Changeset you were viewing without having to use the back button for your browser.

A forward button could also be implemented.

lectrician1 avatar Nov 22 '20 01:11 lectrician1

So basically you want us to cache all the search results and implement the navigation ourselves with a full history inside javascript rather than leveraging the browser history as we do now?

It think that's pretty unlikely - it sounds like it would be a huge amount of work.

I mean if somebody wants to write it we could review it but I worry that it would be so large and complex that I would be concerned about merging it.

tomhughes avatar Nov 22 '20 08:11 tomhughes

javascript rather than leveraging the browser history as we do now?

The problem is that we don't cache the results in the browser history at all, as @lectrician1 demonstrates (and as I found recently too). When you hit the back button, it makes a second overpass request.

Personally I think the solution is to reduce the javascript in the first place, and use more server-side stuff. I think the results caching would work better if the call to overpass was moved server-side, and the browser is just requesting page fragments from rails, rather than talking to overpass directly. That way, the html is all cached normally in the browser, since it's not dependent on any javascript re-running after hitting the back button.

gravitystorm avatar Nov 22 '20 11:11 gravitystorm

Well if you're lucky that might help but @lectrician1 is really asking for the opposite, to move everything client side so the client can keep a history and go back and forth without making calls to any servers.

tomhughes avatar Nov 22 '20 11:11 tomhughes

Server side rendering might be quite challenging due to the IP-based rate limiting on the overpass instance.

mmd-osm avatar Nov 22 '20 14:11 mmd-osm

If the Query Features page fragment were an iframe, we’d be able to rely on the browser’s bfcache when going back to earlier results. But we’d have to rework some functionality, such as highlighting elements on the map on hover, to work across the iframe boundary.

1ec5 avatar Dec 09 '25 08:12 1ec5