本文整理汇总了Java中redis.clients.jedis.params.geo.GeoRadiusParam类的典型用法代码示例。如果您正苦于以下问题:Java GeoRadiusParam类的具体用法?Java GeoRadiusParam怎么用?Java GeoRadiusParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoRadiusParam类属于redis.clients.jedis.params.geo包,在下文中一共展示了GeoRadiusParam类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Test
public void georadiusByMember() {
jedis.geoadd("Sicily", 13.583333, 37.316667, "Agrigento");
jedis.geoadd("Sicily", 13.361389, 38.115556, "Palermo");
jedis.geoadd("Sicily", 15.087269, 37.502669, "Catania");
List<GeoRadiusResponse> members = jedis.georadiusByMember("Sicily", "Agrigento", 100,
GeoUnit.KM);
assertEquals(2, members.size());
members = jedis.georadiusByMember("Sicily", "Agrigento", 100, GeoUnit.KM, GeoRadiusParam
.geoRadiusParam().sortAscending());
assertEquals(2, members.size());
assertEquals("Agrigento", members.get(0).getMemberByString());
assertEquals("Palermo", members.get(1).getMemberByString());
members = jedis.georadiusByMember("Sicily", "Agrigento", 100, GeoUnit.KM, GeoRadiusParam
.geoRadiusParam().sortAscending().count(1).withCoord().withDist());
assertEquals(1, members.size());
GeoRadiusResponse member = members.get(0);
assertEquals("Agrigento", member.getMemberByString());
assertTrue(equalsWithinEpsilon(0, member.getDistance()));
assertTrue(equalsWithinEpsilon(13.583333, member.getCoordinate().getLongitude()));
assertTrue(equalsWithinEpsilon(37.316667, member.getCoordinate().getLatitude()));
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:GeoCommandsTest.java
示例2: georadiusByMemberBinary
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Test
public void georadiusByMemberBinary() {
jedis.geoadd(bfoo, 13.583333, 37.316667, bA);
jedis.geoadd(bfoo, 13.361389, 38.115556, bB);
jedis.geoadd(bfoo, 15.087269, 37.502669, bC);
List<GeoRadiusResponse> members = jedis.georadiusByMember(bfoo, bA, 100, GeoUnit.KM);
assertEquals(2, members.size());
members = jedis.georadiusByMember(bfoo, bA, 100, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending());
assertEquals(2, members.size());
assertArrayEquals(bA, members.get(0).getMember());
assertArrayEquals(bB, members.get(1).getMember());
members = jedis.georadiusByMember(bfoo, bA, 100, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending().count(1).withCoord().withDist());
assertEquals(1, members.size());
GeoRadiusResponse member = members.get(0);
assertArrayEquals(bA, member.getMember());
assertTrue(equalsWithinEpsilon(0, member.getDistance()));
assertTrue(equalsWithinEpsilon(13.583333, member.getCoordinate().getLongitude()));
assertTrue(equalsWithinEpsilon(37.316667, member.getCoordinate().getLatitude()));
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:26,代码来源:GeoCommandsTest.java
示例3: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude,
double radius, GeoUnit unit, GeoRadiusParam param) {
Span span = helper.buildSpan("georadius", key);
span.setTag("longitude", longitude);
span.setTag("latitude", latitude);
span.setTag("radius", radius);
span.setTag("unit", unit.name());
span.setTag("param", TracingHelper.toString(param.getByteParams()));
try {
return super.georadius(key, longitude, latitude, radius, unit, param);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
开发者ID:opentracing-contrib,项目名称:java-redis-client,代码行数:19,代码来源:TracingJedisCluster.java
示例4: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius,
GeoUnit unit, GeoRadiusParam param) {
Span span = helper.buildSpan("georadiusByMember", key);
span.setTag("member", Arrays.toString(member));
span.setTag("radius", radius);
span.setTag("unit", unit.name());
span.setTag("param", TracingHelper.toString(param.getByteParams()));
try {
return super.georadiusByMember(key, member, radius, unit, param);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
开发者ID:opentracing-contrib,项目名称:java-redis-client,代码行数:18,代码来源:TracingJedisCluster.java
示例5: radious
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
public List<Postion> radious(String type, GeoCoordinate center, Long distinct, Boolean asc) {
List<Postion> postions = new ArrayList<Postion>();
Jedis jedis = redisConnection.getJedis();
try {
GeoRadiusParam geoRadiusParam = GeoRadiusParam.geoRadiusParam().withCoord().withDist();
if (asc) {
geoRadiusParam.sortAscending();
} else {
geoRadiusParam.sortDescending();
}
List<GeoRadiusResponse> responses = jedis.georadius(type,
center.getLongitude(),
center.getLatitude(),
distinct.doubleValue(),
GeoUnit.M,
geoRadiusParam);
if (responses != null) {
for (GeoRadiusResponse response : responses) {
Postion postion = new Postion(response.getMemberByString(),
type,
response.getCoordinate().getLongitude(),
response.getCoordinate().getLatitude());
postion.setDistinct(response.getDistance());
postions.add(postion);
}
}
} finally {
if (jedis != null) {
jedis.close();
}
}
return postions;
}
开发者ID:gaochao2000,项目名称:redis_util,代码行数:35,代码来源:LBSServiceRedisImpl.java
示例6: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit,
GeoRadiusParam param) {
checkIsInMultiOrPipeline(key);
client.georadius(key, longitude, latitude, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:Jedis.java
示例7: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit,
GeoRadiusParam param) {
checkIsInMultiOrPipeline(key);
client.georadiusByMember(key, member, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:Jedis.java
示例8: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit,
GeoRadiusParam param) {
checkIsInMultiOrPipeline(key);
client.georadius(key, longitude, latitude, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:BinaryJedis.java
示例9: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit,
GeoRadiusParam param) {
checkIsInMultiOrPipeline(key);
client.georadiusByMember(key, member, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:BinaryJedis.java
示例10: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(final String key, final double longitude, final double latitude,
final double radius, final GeoUnit unit, final GeoRadiusParam param) {
return new JedisClusterCommand<List<GeoRadiusResponse>>(connectionHandler, maxAttempts) {
@Override
public List<GeoRadiusResponse> execute(Jedis connection) {
return connection.georadius(key, longitude, latitude, radius, unit, param);
}
}.run(key);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:JedisCluster.java
示例11: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(final String key, final String member, final double radius,
final GeoUnit unit, final GeoRadiusParam param) {
return new JedisClusterCommand<List<GeoRadiusResponse>>(connectionHandler, maxAttempts) {
@Override
public List<GeoRadiusResponse> execute(Jedis connection) {
return connection.georadiusByMember(key, member, radius, unit, param);
}
}.run(key);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:JedisCluster.java
示例12: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(final byte[] key, final double longitude, final double latitude,
final double radius, final GeoUnit unit, final GeoRadiusParam param) {
return new JedisClusterCommand<List<GeoRadiusResponse>>(connectionHandler, maxAttempts) {
@Override
public List<GeoRadiusResponse> execute(Jedis connection) {
return connection.georadius(key, longitude, latitude, radius, unit, param);
}
}.runBinary(key);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:BinaryJedisCluster.java
示例13: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(final byte[] key, final byte[] member, final double radius,
final GeoUnit unit, final GeoRadiusParam param) {
return new JedisClusterCommand<List<GeoRadiusResponse>>(connectionHandler, maxAttempts) {
@Override
public List<GeoRadiusResponse> execute(Jedis connection) {
return connection.georadiusByMember(key, member, radius, unit, param);
}
}.runBinary(key);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:BinaryJedisCluster.java
示例14: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Test
public void georadius() {
// prepare datas
Map<String, GeoCoordinate> coordinateMap = new HashMap<String, GeoCoordinate>();
coordinateMap.put("Palermo", new GeoCoordinate(13.361389, 38.115556));
coordinateMap.put("Catania", new GeoCoordinate(15.087269, 37.502669));
jedis.geoadd("Sicily", coordinateMap);
List<GeoRadiusResponse> members = jedis.georadius("Sicily", 15, 37, 200, GeoUnit.KM);
assertEquals(2, members.size());
// sort
members = jedis.georadius("Sicily", 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending());
assertEquals(2, members.size());
assertEquals("Catania", members.get(0).getMemberByString());
assertEquals("Palermo", members.get(1).getMemberByString());
// sort, count 1
members = jedis.georadius("Sicily", 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending().count(1));
assertEquals(1, members.size());
// sort, count 1, withdist, withcoord
members = jedis.georadius("Sicily", 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending().count(1).withCoord().withDist());
assertEquals(1, members.size());
GeoRadiusResponse response = members.get(0);
assertTrue(equalsWithinEpsilon(56.4413, response.getDistance()));
assertTrue(equalsWithinEpsilon(15.087269, response.getCoordinate().getLongitude()));
assertTrue(equalsWithinEpsilon(37.502669, response.getCoordinate().getLatitude()));
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:33,代码来源:GeoCommandsTest.java
示例15: georadiusBinary
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Test
public void georadiusBinary() {
// prepare datas
Map<byte[], GeoCoordinate> bcoordinateMap = new HashMap<byte[], GeoCoordinate>();
bcoordinateMap.put(bA, new GeoCoordinate(13.361389, 38.115556));
bcoordinateMap.put(bB, new GeoCoordinate(15.087269, 37.502669));
jedis.geoadd(bfoo, bcoordinateMap);
List<GeoRadiusResponse> members = jedis.georadius(bfoo, 15, 37, 200, GeoUnit.KM);
assertEquals(2, members.size());
// sort
members = jedis.georadius(bfoo, 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending());
assertEquals(2, members.size());
assertArrayEquals(bB, members.get(0).getMember());
assertArrayEquals(bA, members.get(1).getMember());
// sort, count 1
members = jedis.georadius(bfoo, 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending().count(1));
assertEquals(1, members.size());
// sort, count 1, withdist, withcoord
members = jedis.georadius(bfoo, 15, 37, 200, GeoUnit.KM, GeoRadiusParam.geoRadiusParam()
.sortAscending().count(1).withCoord().withDist());
assertEquals(1, members.size());
GeoRadiusResponse response = members.get(0);
assertTrue(equalsWithinEpsilon(56.4413, response.getDistance()));
assertTrue(equalsWithinEpsilon(15.087269, response.getCoordinate().getLongitude()));
assertTrue(equalsWithinEpsilon(37.502669, response.getCoordinate().getLatitude()));
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:33,代码来源:GeoCommandsTest.java
示例16: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
public java.util.List<IMendixObject> georadius(IContext context, String Key, double Latitude, double Longitude,
double Radius, redisconnector.proxies.Enum_GeoUnit Unit, int Max) {
try {
redis = pool.getResource();
setDatabase();
_logNode.debug("georadius " + Key + "," + Longitude + "," + "," + Latitude + "," + Radius + "," + Unit);
List<GeoRadiusResponse> results;
GeoRadiusParam param = GeoRadiusParam.geoRadiusParam().sortAscending().withCoord().withDist();
if (Max > 0) {
param.count(Max);
}
results = redis.georadius(Key, Longitude, Latitude, Radius, GetGeoUnitByEnum(Unit), param);
ArrayList<IMendixObject> resultList = new ArrayList<IMendixObject>();
for (GeoRadiusResponse object : results) {
GeoPosition row = new GeoPosition(context);
row.setName(object.getMemberByString());
row.setLatitude(new BigDecimal(object.getCoordinate().getLatitude(), MathContext.DECIMAL64));
row.setLongitude(new BigDecimal(object.getCoordinate().getLongitude(), MathContext.DECIMAL64));
row.setDistance(new BigDecimal(object.getDistance(), MathContext.DECIMAL64));
resultList.add(row.getMendixObject());
}
return resultList;
} catch (JedisConnectionException e) {
if (redis != null) {
redis.close();
}
throw e;
} finally {
if (redis != null) {
redis.close();
}
}
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:39,代码来源:RedisConnector.java
示例17: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude,
double radius, GeoUnit unit, GeoRadiusParam param) {
checkIsInMultiOrPipeline();
client.georadius(key, longitude, latitude, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:8,代码来源:Jedis.java
示例18: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius,
GeoUnit unit, GeoRadiusParam param) {
checkIsInMultiOrPipeline();
client.georadiusByMember(key, member, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:9,代码来源:Jedis.java
示例19: georadius
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude,
double radius, GeoUnit unit, GeoRadiusParam param) {
checkIsInMultiOrPipeline();
client.georadius(key, longitude, latitude, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:8,代码来源:BinaryJedis.java
示例20: georadiusByMember
import redis.clients.jedis.params.geo.GeoRadiusParam; //导入依赖的package包/类
@Override
public List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius,
GeoUnit unit, GeoRadiusParam param) {
checkIsInMultiOrPipeline();
client.georadiusByMember(key, member, radius, unit, param);
return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:8,代码来源:BinaryJedis.java
注:本文中的redis.clients.jedis.params.geo.GeoRadiusParam类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论