My web app has a need to very roughly locate the user in order to calculate sunset and sunrise times.
Since geolocation features necessarily ask the user for permission, I'm brainstorming other ways to get at the location in a way that is good enough for this application.
The timezone offset isn't enough, as
- I need latitude as well and
- the offset is often astronomically wrong by one or two hours.
Luckily, browsers can get at the tz database name (eg. Europe/Madrid) configured in the OS these days. Now it's just a question of getting the coordinates for the city in question.
Even though there are several services that give you a timezone for coordinates, I haven't seen the reverse and I couldn't find a library with coordinates either.
I could create my own from geolocation services, but this is a bit tedious and error-prone to do, so I'd first like to check if somebody has a better idea.