Giter VIP home page Giter VIP logo

Comments (3)

madsnedergaard avatar madsnedergaard commented on August 22, 2024

Hey, thanks for creating an issue :)

The API will attempt to find the nearest zone to the coordinates supplied if they are not within a known zone.
If the coordinates are more than 50 km away from a known zone (like they clearly are in this case), the API attempts to get the caller location based on the server used to call the API.

So what happens here is that it's trying to guess where you're currently calling from, which might be why it's also changing from time to time depending on your setup.

The API documentation briefly mentions this, but we should probably make it more clear :)

⚠️ Auto fallback: If no zone is detected (or we don't have data for that area), the API will attempt to use your current location based on IP of the caller

from electricitymaps-contrib.

pdcisco avatar pdcisco commented on August 22, 2024

@madsnedergaard Thank you for the clarification, but the behaviour seems like a bug. The magic that the APIs are doing is not helpful in the context where a location is explicitly provided as lat/long or zone. Perhaps the current behaviour could be optional? Asking for data in one location and getting different location data as response definitely feels odd.

from electricitymaps-contrib.

madsnedergaard avatar madsnedergaard commented on August 22, 2024

That's a good point, we'll discuss it internally - while I agree with your solution (no server-detection if location is explicitly set), we might have other clients that are actually relying on that functionality. That makes it a bit more tricky to just change, but I'll see what we can do :)

from electricitymaps-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.