Julian Simioni
16667199cd
feat(geo_common): improve boundary.rect error message
...
In the case where a min lat/lon is larger than a max lat/lon, the error
message was a bit confusing as it did not show the actual property name
or the values that are causing errors.
6 years ago
Julian Simioni
1553dfb103
fix(geo_common): check for invalid bbox where min=max
...
This condition will cause Elasticsearch to throw an error, we should
catch it outselves first.
The error is more friendly than the case where min>max, but still an
error.
Connects https://github.com/pelias/api/pull/1050
6 years ago
Julian Simioni
f1afda469d
Move bbox min/max check to its own function
6 years ago
Julian Simioni
76bc5c654d
fix(geo_common): check bbox parameters are within range
...
If bounding box lat/lon values are outside the correct range,
Elasticsearch throws very alarming errors.
With a little validation code we can provide more friendly and
actionable error messages.
Fixes https://github.com/pelias/pelias/issues/750
6 years ago
Julian Simioni
8a9c31e46e
Remove usage of util.format
6 years ago
Julian Simioni
1054a634de
chore(geo_common): refactor bbox min/max validation
6 years ago
Julian Simioni
3c33b98f8a
chore(geo_common): only set bbox coords if it validates
6 years ago
Peter Backx
f16565df9e
Verify min and max longitude and latitude
...
Otherwise this can potentially lead to a fairly weird Elasticsearch error mentioned in https://github.com/pelias/pelias/issues/656
7 years ago
Stephen Hess
3763d0b503
renamed `sanitise` -> `sanitize`
8 years ago
Peter Johnson
5b8a9a31d2
wrap coordinates at poles
8 years ago
Julian Simioni
b84652ba20
Refactor sanitize_coord parameter handling
...
This should help reduce duplication when passing values in, as the key
won't have to be specified twice. Also, the parameters are in the same
order as the other sanitize_* methods.
9 years ago
Julian Simioni
c3417a0ace
Cleanup comments for usage of groups sanitizer
9 years ago
Julian Simioni
b315adc6aa
Use groups sanitiser in sanitize_circle
9 years ago
Julian Simioni
415029e02b
Use groups sanitiser in sanitize_rect and sanitize_point
9 years ago
Stephen Hess
2ba206f122
removed debug
9 years ago
Stephen Hess
0f6d08c0ec
set boundary.circle.radius to default if caller did not supply it
9 years ago
Stephen Hess
0595a29052
renamed parameters for readability
9 years ago
Stephen Hess
9fdddd3834
unrolled not-not conditional to positive conditional
9 years ago
Stephen Hess
947797f41e
added warning if any of boundary.circle.lat/lon/radius are supplied + tests
9 years ago
Peter Johnson
82ab899ecc
progress commit
9 years ago
Julian Simioni
4260442f59
Change boundary.circle params to flat string structure
9 years ago
Peter Johnson
e726636c3d
merge with master
9 years ago
Peter Johnson
10242a8682
rename unclean->raw
9 years ago
Peter Johnson
e532c2a88a
improved error checking
9 years ago
Peter Johnson
052904e2e5
documentation typo
9 years ago
Peter Johnson
bf42290c7c
refactor sanitizers: first pass
9 years ago
Diana Shkolnikov
feb1b0a6cd
Update /reverse endpoint params and query as per API spec
9 years ago
Julian Simioni
0d23792591
Split geo sanitiser into geo_reverse and geo_search
...
Common functions are moved to geo_common. This is required to allow
separate behavior for search and reverse.
9 years ago
Julian Simioni
fd3b12cfa9
Remove all references to non-existent zoom parameter
9 years ago
Julian Simioni
b547111d52
Remove latitude restrictions
9 years ago
Julian Simioni
17ba5da6d5
Replace array iteration boilerplate with .map
...
Keeps the focus of the code on the actions to be performed, rather than
the grunt work of iterating through the array.
9 years ago
Julian Simioni
b68bae2555
Remove latitude limits
9 years ago
Severyn Kozak
78bea9d814
sanitiser/_geo.js: don't pass base to parseFloat().
9 years ago
Severyn Kozak
8868039835
Verify that bbox longitude is not NaN.
...
sanitiser/_geo.js
-The removal of the longitude sanitizer might result in a NaN
longitude value passing through in the bbox. Add an `isNaN()`
check.
9 years ago
Severyn Kozak
d000868800
Remove checks for longitude validity.
...
sanitiser/_geo.js
-Remove the code that verified `longitude` validity, to allow
longitude values outside of the value's real range, [-180, 180].
elasticsearch appears to handle them gracefully, so this
resolves #56 .
9 years ago
Diana Shkolnikov
e3cdda9778
ugh another comment fix
10 years ago
Diana Shkolnikov
6ae1a4f7df
fix comments and tests
10 years ago
Diana Shkolnikov
7c81c56cf3
Fix bbox comment
10 years ago
Diana Shkolnikov
8ac17d0cb2
Fix bbox parsing
10 years ago
Harish Krishna
176f580215
using is-object
10 years ago
Harish Krishna
7a8422025a
latlon is a required field for reverse (updated _geo sanitizer) and added ability to filter by layers on /reverse
10 years ago
Harish Krishna
650e88d79f
making geo bias optional - first pass with all tests passing
10 years ago
Harish Krishna
3973039f19
min/max lat/lon to form bbox from the input params
10 years ago
Harish Krishna
84670180f7
renaming _latlonzoom to _geo
10 years ago
Harish Krishna
245abd7809
elasticsearch-backend now only accepts vertices and not latlon as properties
10 years ago
Harish Krishna
ebf162f29e
search with optional bbox - initial commit +tests
10 years ago
Peter Johnson
03a60831b4
fix lat error
10 years ago
Harish Krishna
32275aca56
split sanitizers into reusable pieces. renaming sanitise to suggest. using suggest sanitizer for search. adding reverse sanitizer. updating tests..
10 years ago