Closed evgakis closed 2 years ago
Hi, thanks for opening an issue!
If you host opentopodata yourself you can call it from the browser just fine, the software supports it.
But for the public api that I host at api.opentopodata.org, CORS requests are unfortunately disabled as the bypass the IP-based ratelimiting I use to ensure the server is stable for everyone.
There's more information here: https://github.com/ajnisbet/opentopodata/issues/9
The open software in this repo has full support for browser-based fetch requests and CORS policy. However, the free instance I'm hosting at api.opentopodata.org is configured to block cross-origin requests. These requests effectively bypass the per-IP rate limit, and I want to make sure the server has enough capacity for everyone!
So there are a couple of options to get this working:
- Host ajnisbet/opentopodata on your own server with CORS enabled
- Proxy requests from api.opentopodata.org through your own server, adding the appropriate CORS header
- If you're working on academic research or a small non-commercial project, send me an email and I can add you to a whitelist on the public api.
- Use the GPXZ elevation api
I try to call the api with
`function onGet(url) {
}`
but I receive an error. Is it possible to call https://api.opentopodata.org/v1/eudem25m?locations= from javascript?