umap-project/umap

Control embed map from a JS API

Opened this issue · 1 comments

Now that we are going the web component and modules way, it would be quite useful to let advanced users interact with the map from the parent page, eg. for showing a given layer or feature on a user click.

Could be something like:

<script src="https://to.umap.source" type="module">
<script type="module">
    const mymap = new Umap("#element", settings)
    mymap.showLayer(id)
    mymap.showFeature(id_or_selector)
</script>

Public methods I could think of:

  • setBbox
  • setCenter and zoom
  • hide/show a datalayer
  • view a feature
  • set/unset a filter

For inspiration, here is what Whereby is doing: https://docs.whereby.com/reference/using-the-whereby-embed-element