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

Geolocate user and center map #475

Open
iandunn opened this issue Apr 11, 2023 · 0 comments
Open

Geolocate user and center map #475

iandunn opened this issue Apr 11, 2023 · 0 comments

Comments

@iandunn
Copy link
Member

iandunn commented Apr 11, 2023

if we can default the "crop" to the continent you are most likely to be on, the zoomed in view you'll see is likely also going to be the one you have a realistic chance of going to. I.e. if I'm in North America, I see adjacent events, etc.
WordPress/wp20.wordpress.net#54 (comment)

To do that I think we'll need to geolocate the user from their IP, and then center the map on those coordinates. Ideally we can do that server-side without any API requests, to avoid delayed the initial map render or having to move the center after the initial render.

That rules out using api.w.org/events directly, but we could maybe use a local copy of the same geolocation database. Another approach would be using the Geolocation API in the browser. When using the map on wordpress.org/wordcamp.org, we should be able to access ip2location.

Since the ultimate goal is to make sure the user can see the filtered markers, it might also work to pass the coordinates of those markers to fitBounds.

@iandunn iandunn transferred this issue from WordPress/wp20.wordpress.net Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant