Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "query" event which allows interception of the result of a map query #105

Open
prushforth opened this issue Jan 31, 2018 · 1 comment

Comments

@prushforth
Copy link
Member

Recent developments in MapML allow the map author to include a query template per extent. This enables the user to click on the map (layer) and query the underlying URL via that template. However, it is clear that the response format from such a query might not be under the control of the map author, so it would be ideal to be able to intercept and/or transform the response prior to or in lieu of the default behaviour (which today is a Leaflet popup).
image

The idea would be that sometimes a query returns JSON or other format which is less directly useful in a popup or other browsing context. The HTML author could supply an event handler which intercepted the query response and did whatever it would like to it, including:

  • suppressing/preventing it entirely, or intercepting the response before rendering it
  • transforming the response to some other format e.g. JSON->HTML
  • adding custom style information
  • a combination of the previous items, together with re-locating the output into the main context

I think this should be a programmatic interface, in that the map element behaviour would be progressively enhance-able with script via this API.

You can see an example of a query that returns a JSON response here, (just click on one of the power station symbols) which shows that it needs at least transformation via script. Sorry I noticed that the tap event on my android phone doesn't work reliably in Chrome. Probably best to try on a desktop browser for now.

In contrast an HTML response is more easily handled without script, although there could be situations where the content returned is not suitable to the popup/bubble browsing context. I don't think there's much to be done about that, except to say that perhaps the map element could provide CSS class for the popup/ bubble that could be used by the HTML author to target such content?

image

Other considerations requiring feedback include security, user interface / affordance for the query (currently there's no affordance, it just happens or not if the query template is included in the map document).

Comments welcome.

@prushforth
Copy link
Member Author

This is one such aspect of the API required by Maps4HTML/HTML-Map-Element#3

@prushforth prushforth transferred this issue from Maps4HTML/HTML-Map-Element Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant