Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
dfd3ead9
Unverified
Commit
dfd3ead9
authored
Apr 15, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
Apr 15, 2020
Browse files
Merge pull request #7078 from karelrooted/fix/geo-hash-edge-case
FIX truncate max/min longitude,latitude related geo_point
parents
7428f512
3fbfa188
Changes
1
Show whitespace changes
Inline
Side-by-side
src/geohash.c
View file @
dfd3ead9
...
...
@@ -206,7 +206,11 @@ int geohashDecodeWGS84(const GeoHashBits hash, GeoHashArea *area) {
int
geohashDecodeAreaToLongLat
(
const
GeoHashArea
*
area
,
double
*
xy
)
{
if
(
!
xy
)
return
0
;
xy
[
0
]
=
(
area
->
longitude
.
min
+
area
->
longitude
.
max
)
/
2
;
if
(
xy
[
0
]
>
GEO_LONG_MAX
)
xy
[
0
]
=
GEO_LONG_MAX
;
if
(
xy
[
0
]
<
GEO_LONG_MIN
)
xy
[
0
]
=
GEO_LONG_MIN
;
xy
[
1
]
=
(
area
->
latitude
.
min
+
area
->
latitude
.
max
)
/
2
;
if
(
xy
[
1
]
>
GEO_LAT_MAX
)
xy
[
1
]
=
GEO_LAT_MAX
;
if
(
xy
[
1
]
<
GEO_LAT_MIN
)
xy
[
1
]
=
GEO_LAT_MIN
;
return
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment