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

Evented API support (moveend) #62

Open
gamecubate opened this issue Nov 29, 2023 · 4 comments
Open

Evented API support (moveend) #62

gamecubate opened this issue Nov 29, 2023 · 4 comments

Comments

@gamecubate
Copy link

gamecubate commented Nov 29, 2023

I need to handle map moveend events (with Kino.MapLibre) but am not sure how to proceed.

Would this require forking/augmenting the project or is the functionality already built-in ?

@cristineguadelupe
Copy link
Collaborator

Hey @gamecubate! It's not built-in. We have implemented only an initial subset of the Maplibre events.

@josevalim
Copy link
Contributor

PRs are welcome!

@gamecubate
Copy link
Author

gamecubate commented Dec 6, 2023

You forgot to ;)

@gamecubate
Copy link
Author

gamecubate commented Dec 8, 2023

Not sure this can be pulled off, or how.

The idea (frequent use case in my line of work -- dataviz and maps) is for a GET request to be sent to a backend API once and whenever map navigation has ended, say pursuant to a drag and pan action by the user; the query params of the request would include the map bounds of interest.

The way I usually do it with mapboxgl.js is, simplified:

map.on("moveend", refresh);

const refresh = () => {
  const resp = await fetch(`${SERVICE_API_URL}/?bounds=${encode(map.getBounds())}`); 
  const data = await resp.json();
  update_map(data);
}

For KinoMapLibre, to keep things flexible, some Ml.on_moveend(map, handler) functionality would be needed and I'm not sure whether (maplibre.js) map instances can communicate with a KinoMapLibre elixir process.

I'll look into it but let me know if this is clearly a non-starter.

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

3 participants