Comments (6)
@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.
@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.
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.
@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.
After reading @danswick's points, I too agree that this validator is not really a general purpose validator.
from fusspot.
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)
- Implement `strictShapeOf`
- New name HOT 2
- Implement and/or document extension mechanism
- Maybe remove date and coordinates validators, which seem specific to mapbox-sdk-js HOT 3
- Unnecessary space between items in list
- Enable NODE_ENV performance optimisation
- Using fusspot for more than validation?
- Remove stickler HOT 1
- Non-empty string assertion HOT 1
- Shortcut to set apiName option — possibly rename that option HOT 2
- Object-shape validation does not require that the object be a plain object
- v.number should reject NaN HOT 4
- Add Date object validator HOT 1
- f.strictShape should ensure a property is there, regardless of property's type
- 0.7.1 is a breaking change HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fusspot.