Module: Redis::Commands::Geo

Included in:
Redis::Commands
Defined in:
lib/redis/commands/geo.rb

Instance Method Summary collapse

Instance Method Details

#geoadd(key, *member) ⇒ Integer

Adds the specified geospatial items (latitude, longitude, name) to the specified key



11
12
13
# File 'lib/redis/commands/geo.rb', line 11

def geoadd(key, *member)
  send_command([:geoadd, key, *member])
end

#geodist(key, member1, member2, unit = 'm') ⇒ String?

Returns the distance between two members of a geospatial index



70
71
72
# File 'lib/redis/commands/geo.rb', line 70

def geodist(key, member1, member2, unit = 'm')
  send_command([:geodist, key, member1, member2, unit])
end

#geohash(key, member) ⇒ Array<String, nil>

Returns geohash string representing position for specified members of the specified key.



20
21
22
# File 'lib/redis/commands/geo.rb', line 20

def geohash(key, member)
  send_command([:geohash, key, member])
end

#geopos(key, member) ⇒ Array<Array<String>, nil>

Returns longitude and latitude of members of a geospatial index



60
61
62
# File 'lib/redis/commands/geo.rb', line 60

def geopos(key, member)
  send_command([:geopos, key, member])
end

#georadius(*args, **geoptions) ⇒ Array<String>

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point



33
34
35
36
37
# File 'lib/redis/commands/geo.rb', line 33

def georadius(*args, **geoptions)
  geoarguments = _geoarguments(*args, **geoptions)

  send_command([:georadius, *geoarguments])
end

#georadiusbymember(*args, **geoptions) ⇒ Array<String>

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from an already existing member



48
49
50
51
52
# File 'lib/redis/commands/geo.rb', line 48

def georadiusbymember(*args, **geoptions)
  geoarguments = _geoarguments(*args, **geoptions)

  send_command([:georadiusbymember, *geoarguments])
end