Git Product home page Git Product logo

Comments (6)

kepta avatar kepta commented on June 25, 2024

@davidtheclark I think mapbox-gl-js complains if the lat lon exceeds 180 / 90. Should we keep our validator in sync with how gl-js validates coords?

from fusspot.

davidtheclark avatar davidtheclark commented on June 25, 2024

@kepta I think that our APIs often do not, though. I believe this is how you'd get directions crossing the antimeridian instead of going around the world to avoid it — right?

from fusspot.

danswick avatar danswick commented on June 25, 2024

Interesting question that I will annoyingly respond to with another question: under what circumstances do we anticipate people will use this validator and what is it for?

  • You want to display something using your coordinates on a web map (Mapbox GL JS, Leaflet, etc):
    • for longitude can probably be whatever since we use the old "many worlds" trick to handle issues with features that cross the international dateline. However, only some libraries know how to handle lon values >180 or <-180.
    • for latitude: longitude can be assumed to be in the Spherical Mercator projection, which only goes to +/- 85.06 degrees anyway, so we probably want to use those values for validation.
  • You want to make sure your coordinates are valid before you save some data. In that case, it's probably best to do a strict validation as-is.

Perhaps it would be useful to incorporate two types of coordinate validation? One for displaying stuff on a web map and one for saving data.

from fusspot.

davidtheclark avatar davidtheclark commented on June 25, 2024

@danswick good points. I think that those points illustrate that we shouldn't include this validator by default, because it includes too many assumptions, is not general-purpose enough. If we have a good range validator, that could make it easy enough for consumers to enforce whatever they need, right? (And for mapbox-sdk-js, I suggest we let the APIs themselves handle coordinate validation.)

from fusspot.

kepta avatar kepta commented on June 25, 2024

After reading @danswick's points, I too agree that this validator is not really a general purpose validator.

from fusspot.

danswick avatar danswick commented on June 25, 2024

if we have a good range validator, that could make it easy enough for consumers to enforce whatever they need, right?

This makes sense to me!

(And for mapbox-sdk-js, I suggest we let the APIs themselves handle coordinate validation.)

Agreed.

from fusspot.

Related Issues (16)

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.