org.springframework.data.geo.GeoResults Java Examples
The following examples show how to use
org.springframework.data.geo.GeoResults.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestaurantController.java From flash-waimai with MIT License | 7 votes |
@RequestMapping(value = "/v4/restaurants", method = RequestMethod.GET) public Object restaurants(@RequestParam("geohash") String geoHash, @RequestParam("keyword") String keyWord) { String[] geoHashArr = geoHash.split(","); String longitude = geoHashArr[1]; String latitude = geoHashArr[0]; Map<String, Object> params = Maps.newHashMap("name", keyWord); System.out.println(Json.toJson(params)); GeoResults<Map> geoResults = mongoRepository.near(Double.valueOf(longitude), Double.valueOf(latitude), "shops", params); List<GeoResult<Map>> geoResultList = geoResults.getContent(); List<Map> list = Lists.newArrayList(); for (int i = 0; i < geoResultList.size(); i++) { Map map = geoResultList.get(i).getContent(); Distance distance = new Distance(Double.valueOf(longitude), Double.valueOf(latitude), Double.valueOf(map.get("longitude").toString()), Double.valueOf(map.get("latitude").toString())); map.put("distance", distance.getDistance()); list.add(map); } return Rets.success(list); }
Example #2
Source File: CustomerRepositoryIntegrationTest.java From spring-data-examples with Apache License 2.0 | 6 votes |
/** * Test case to show the usage of the geo-spatial APIs to lookup people within a given distance of a reference point. */ @Test public void exposesGeoSpatialFunctionality() { GeospatialIndex indexDefinition = new GeospatialIndex("address.location"); indexDefinition.getIndexOptions().put("min", -180); indexDefinition.getIndexOptions().put("max", 180); operations.indexOps(Customer.class).ensureIndex(indexDefinition); Customer ollie = new Customer("Oliver", "Gierke"); ollie.setAddress(new Address(new Point(52.52548, 13.41477))); ollie = repository.save(ollie); Point referenceLocation = new Point(52.51790, 13.41239); Distance oneKilometer = new Distance(1, Metrics.KILOMETERS); GeoResults<Customer> result = repository.findByAddressLocationNear(referenceLocation, oneKilometer); assertThat(result.getContent(), hasSize(1)); Distance distanceToFirstStore = result.getContent().get(0).getDistance(); assertThat(distanceToFirstStore.getMetric(), is(Metrics.KILOMETERS)); assertThat(distanceToFirstStore.getValue(), closeTo(0.862, 0.001)); }
Example #3
Source File: GeoOperationsTests.java From spring-data-examples with Apache License 2.0 | 5 votes |
/** * Look up points using a geo-index member as reference. */ @Test public void geoRadiusByMember() { GeoResults<GeoLocation<String>> byDistance = geoOperations.geoRadiusByMember("Sicily", "Palermo", new Distance(100, DistanceUnit.KILOMETERS)); assertThat(byDistance).hasSize(2).extracting("content.name").contains("Arigento", "Palermo"); GeoResults<GeoLocation<String>> greaterDistance = geoOperations.geoRadiusByMember("Sicily", "Palermo", new Distance(200, DistanceUnit.KILOMETERS)); assertThat(greaterDistance).hasSize(3).extracting("content.name").contains("Arigento", "Catania", "Palermo"); }
Example #4
Source File: MongoRepository.java From flash-waimai with MIT License | 5 votes |
/** * 查询指定位置附近的商家 * @param x * @param y * @param collectionName * @param params * @param miles 公里数 * @return */ public GeoResults<Map> near(double x, double y, String collectionName, Map<String, Object> params,Integer miles) { Point location = new Point(x, y); NearQuery nearQuery = NearQuery.near(location).maxDistance(new Distance(miles, Metrics.MILES)); if (params != null && !params.isEmpty()) { Query query = Query.query(criteria(params)); nearQuery.query(query); } try { return mongoTemplate.geoNear(nearQuery, Map.class, collectionName); }catch (Exception e){ System.out.println(e.getMessage()); } return null; }
Example #5
Source File: GeoOperationsTests.java From spring-data-examples with Apache License 2.0 | 5 votes |
/** * Lookup points within a circle around coordinates. */ @Test public void geoRadius() { Circle circle = new Circle(new Point(13.583333, 37.316667), // new Distance(100, DistanceUnit.KILOMETERS)); GeoResults<GeoLocation<String>> result = geoOperations.geoRadius("Sicily", circle); assertThat(result).hasSize(2).extracting("content.name").contains("Arigento", "Palermo"); }
Example #6
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
Example #7
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(convert(within.getCenter().getX())); params.add(convert(within.getCenter().getY())); params.add(within.getRadius().getValue()); params.add(within.getRadius().getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(within.getRadius().getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #8
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(member); params.add(radius.getValue()); params.add(radius.getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(radius.getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #9
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
Example #10
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(convert(within.getCenter().getX())); params.add(convert(within.getCenter().getY())); params.add(within.getRadius().getValue()); params.add(within.getRadius().getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(within.getRadius().getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #11
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(member); params.add(radius.getValue()); params.add(radius.getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(radius.getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #12
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
Example #13
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(convert(within.getCenter().getX())); params.add(convert(within.getCenter().getY())); params.add(within.getRadius().getValue()); params.add(within.getRadius().getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(within.getRadius().getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #14
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(member); params.add(radius.getValue()); params.add(radius.getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(radius.getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #15
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { RedisCommand<GeoResults<GeoLocation<byte[]>>> command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", new GeoResultsDecoder()); return read(key, ByteArrayCodec.INSTANCE, command, key, convert(within.getCenter().getX()), convert(within.getCenter().getY()), within.getRadius().getValue(), within.getRadius().getMetric().getAbbreviation()); }
Example #16
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(convert(within.getCenter().getX())); params.add(convert(within.getCenter().getY())); params.add(within.getRadius().getValue()); params.add(within.getRadius().getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(within.getRadius().getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUS", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #17
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 5 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, GeoRadiusCommandArgs args) { List<Object> params = new ArrayList<Object>(); params.add(key); params.add(member); params.add(radius.getValue()); params.add(radius.getMetric().getAbbreviation()); RedisCommand<GeoResults<GeoLocation<byte[]>>> command; if (args.getFlags().contains(GeoRadiusCommandArgs.Flag.WITHCOORD)) { command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", postitionDecoder); params.add("WITHCOORD"); } else { MultiDecoder<GeoResults<GeoLocation<byte[]>>> distanceDecoder = new ListMultiDecoder2(new GeoResultsDecoder(radius.getMetric()), new GeoDistanceDecoder()); command = new RedisCommand<GeoResults<GeoLocation<byte[]>>>("GEORADIUSBYMEMBER", distanceDecoder); params.add("WITHDIST"); } if (args.getLimit() != null) { params.add("COUNT"); params.add(args.getLimit()); } if (args.getSortDirection() != null) { params.add(args.getSortDirection().name()); } return read(key, ByteArrayCodec.INSTANCE, command, params.toArray()); }
Example #18
Source File: ArangoResultConverter.java From spring-data with Apache License 2.0 | 5 votes |
/** * Build a GeoResults object with the ArangoCursor returned by query execution * * @param cursor * ArangoCursor containing query results * @return GeoResults object with all results */ @SuppressWarnings({ "rawtypes", "unchecked" }) private GeoResults<?> buildGeoResults(final ArangoCursor<?> cursor) { final List<GeoResult<?>> list = new LinkedList<>(); cursor.forEachRemaining(o -> { final GeoResult<?> geoResult = buildGeoResult(o); if (geoResult != null) { list.add(geoResult); } }); return new GeoResults(list); }
Example #19
Source File: CustomerRepository.java From spring-data with Apache License 2.0 | 5 votes |
GeoResults<Customer> findByNameOrSurnameAndLocationWithinOrLocationWithin( String name, String surname, Point location1, Distance distance, Point location2, Range<Distance> distanceRange);
Example #20
Source File: DerivedQueryCreatorTest.java From spring-data with Apache License 2.0 | 5 votes |
@Test public void geoResultsTest() { final List<Customer> toBeRetrieved = new LinkedList<>(); final Customer customer1 = new Customer("", "", 0); customer1.setLocation(new int[] { 43, 21 }); toBeRetrieved.add(customer1); final Customer customer2 = new Customer("", "", 0); customer2.setLocation(new int[] { 21, 43 }); toBeRetrieved.add(customer2); repository.saveAll(toBeRetrieved); final Customer customer3 = new Customer("", "", 0); customer3.setLocation(new int[] { 70, 50 }); repository.save(customer3); final Customer customer4 = new Customer("", "", 0); customer4.setLocation(new int[] { 3, 2 }); repository.save(customer4); final Bound<Double> lowerBound = Bound.inclusive(convertAngleToDistance(30)); final Bound<Double> upperBound = Bound.inclusive(convertAngleToDistance(50)); final GeoResults<Customer> retrieved = repository.findByLocationWithin(new Point(1, 0), Range.of(lowerBound, upperBound)); final List<GeoResult<Customer>> expectedGeoResults = new LinkedList<>(); expectedGeoResults.add(new GeoResult<>(customer1, new Distance(getDistanceBetweenPoints(new Point(1, 0), new Point(21, 43)) / 1000, Metrics.KILOMETERS))); expectedGeoResults.add(new GeoResult<>(customer2, new Distance(getDistanceBetweenPoints(new Point(1, 0), new Point(43, 21)) / 1000, Metrics.KILOMETERS))); assertTrue(equals(expectedGeoResults, retrieved, geoCmp, geoEq, false)); }
Example #21
Source File: DerivedQueryCreatorTest.java From spring-data with Apache License 2.0 | 5 votes |
@Test public void buildPredicateWithDistanceTest() { final List<Customer> toBeRetrieved = new LinkedList<>(); final Customer customer1 = new Customer("+", "", 0); customer1.setLocation(new int[] { 89, 89 }); toBeRetrieved.add(customer1); final Customer customer2 = new Customer("", "+", 0); customer2.setLocation(new int[] { 5, 0 }); toBeRetrieved.add(customer2); final Customer customer3 = new Customer("", "", 0); customer3.setLocation(new int[] { 0, 25 }); toBeRetrieved.add(customer3); repository.saveAll(toBeRetrieved); final Customer customer4 = new Customer("", "", 0); customer4.setLocation(new int[] { 15, 0 }); repository.save(customer4); final Customer customer5 = new Customer("", "", 0); customer5.setLocation(new int[] { 0, 35 }); repository.save(customer5); final double distanceInMeters = convertAngleToDistance(10); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); final Range<Distance> distanceRange = Range.of( Bound.inclusive(new Distance(convertAngleToDistance(20) / 1000, Metrics.KILOMETERS)), Bound.inclusive(new Distance(convertAngleToDistance(30) / 1000, Metrics.KILOMETERS))); final Point location = new Point(0, 0); final GeoResults<Customer> retrieved = repository.findByNameOrSurnameAndLocationWithinOrLocationWithin("+", "+", location, distance, location, distanceRange); final List<GeoResult<Customer>> expectedGeoResults = new LinkedList<>(); expectedGeoResults.add(new GeoResult<>(customer1, new Distance(getDistanceBetweenPoints(location, new Point(89, 89)) / 1000, Metrics.KILOMETERS))); expectedGeoResults.add(new GeoResult<>(customer2, new Distance(getDistanceBetweenPoints(location, new Point(0, 5)) / 1000, Metrics.KILOMETERS))); expectedGeoResults.add(new GeoResult<>(customer3, new Distance(getDistanceBetweenPoints(location, new Point(25, 0)) / 1000, Metrics.KILOMETERS))); assertTrue(equals(expectedGeoResults, retrieved, geoCmp, geoEq, false)); }
Example #22
Source File: TracingRedisConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, GeoRadiusCommandArgs args) { return helper.doInScope(RedisCommand.GEORADIUSBYMEMBER, key, () -> connection.geoRadiusByMember(key, member, radius, args)); }
Example #23
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius) { return read(key, ByteArrayCodec.INSTANCE, GEORADIUSBYMEMBER, key, member, radius.getValue(), radius.getMetric().getAbbreviation()); }
Example #24
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius) { return geoRadiusByMember(key, member, new Distance(radius, DistanceUnit.METERS)); }
Example #25
Source File: ArangoResultConverter.java From spring-data with Apache License 2.0 | 4 votes |
public GeoResults<?> convertGeoResults() { return buildGeoResults(result); }
Example #26
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius) { return read(key, ByteArrayCodec.INSTANCE, GEORADIUSBYMEMBER, key, member, radius.getValue(), radius.getMetric().getAbbreviation()); }
Example #27
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius) { return geoRadiusByMember(key, member, new Distance(radius, DistanceUnit.METERS)); }
Example #28
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius) { return read(key, ByteArrayCodec.INSTANCE, GEORADIUSBYMEMBER, key, member, radius.getValue(), radius.getMetric().getAbbreviation()); }
Example #29
Source File: RedissonConnection.java From redisson with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius) { return geoRadiusByMember(key, member, new Distance(radius, DistanceUnit.METERS)); }
Example #30
Source File: TracingRedisConnection.java From java-redis-client with Apache License 2.0 | 4 votes |
@Override public GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within) { return helper.doInScope(RedisCommand.GEORADIUS, key, () -> connection.geoRadius(key, within)); }