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
ae5fd115
Commit
ae5fd115
authored
Jun 23, 2015
by
antirez
Browse files
Geo: more x,y renamed lat,lon
parent
a3018a21
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/geo.c
View file @
ae5fd115
...
@@ -560,8 +560,8 @@ void geoDecodeCommand(redisClient *c) {
...
@@ -560,8 +560,8 @@ void geoDecodeCommand(redisClient *c) {
geohash
.
step
=
GEO_STEP_MAX
;
geohash
.
step
=
GEO_STEP_MAX
;
geohashDecodeWGS84
(
geohash
,
&
area
);
geohashDecodeWGS84
(
geohash
,
&
area
);
double
y
=
(
area
.
latitude
.
min
+
area
.
latitude
.
max
)
/
2
;
double
lat
=
(
area
.
latitude
.
min
+
area
.
latitude
.
max
)
/
2
;
double
x
=
(
area
.
longitude
.
min
+
area
.
longitude
.
max
)
/
2
;
double
lon
=
(
area
.
longitude
.
min
+
area
.
longitude
.
max
)
/
2
;
/* Returning three nested replies */
/* Returning three nested replies */
addReplyMultiBulkLen
(
c
,
3
);
addReplyMultiBulkLen
(
c
,
3
);
...
@@ -578,8 +578,8 @@ void geoDecodeCommand(redisClient *c) {
...
@@ -578,8 +578,8 @@ void geoDecodeCommand(redisClient *c) {
/* Last, the averaged center of this bounding box */
/* Last, the averaged center of this bounding box */
addReplyMultiBulkLen
(
c
,
2
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyDouble
(
c
,
y
);
addReplyDouble
(
c
,
lat
);
addReplyDouble
(
c
,
x
);
addReplyDouble
(
c
,
lon
);
}
}
void
geoEncodeCommand
(
redisClient
*
c
)
{
void
geoEncodeCommand
(
redisClient
*
c
)
{
...
@@ -613,8 +613,8 @@ void geoEncodeCommand(redisClient *c) {
...
@@ -613,8 +613,8 @@ void geoEncodeCommand(redisClient *c) {
GeoHashArea
area
;
GeoHashArea
area
;
geohashDecodeWGS84
(
geohash
,
&
area
);
geohashDecodeWGS84
(
geohash
,
&
area
);
double
y
=
(
area
.
latitude
.
min
+
area
.
latitude
.
max
)
/
2
;
double
lat
=
(
area
.
latitude
.
min
+
area
.
latitude
.
max
)
/
2
;
double
x
=
(
area
.
longitude
.
min
+
area
.
longitude
.
max
)
/
2
;
double
lon
=
(
area
.
longitude
.
min
+
area
.
longitude
.
max
)
/
2
;
/* Return four nested multibulk replies. */
/* Return four nested multibulk replies. */
addReplyMultiBulkLen
(
c
,
4
);
addReplyMultiBulkLen
(
c
,
4
);
...
@@ -634,6 +634,6 @@ void geoEncodeCommand(redisClient *c) {
...
@@ -634,6 +634,6 @@ void geoEncodeCommand(redisClient *c) {
/* Return the averaged center */
/* Return the averaged center */
addReplyMultiBulkLen
(
c
,
2
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyDouble
(
c
,
y
);
addReplyDouble
(
c
,
lat
);
addReplyDouble
(
c
,
x
);
addReplyDouble
(
c
,
lon
);
}
}
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