Skip to content

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

Open
@prushforth

Description

@prushforth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions