List of usage examples for org.springframework.data.geo Circle Circle
public Circle(double centerX, double centerY, double radius)
From source file:com.afmobi.mongodb.repository.PersonRepositoryIntegrationTests.java
@Test public void findsPeopleByLocationWithinCircle() { Point point = new Point(-73.99171, 40.738868); dave.setLocation(point);//w w w . j ava2 s .c om repository.save(dave); List<Person> result = repository.findByLocationWithin(new Circle(-78.99171, 45.738868, 170)); assertThat(result.size(), is(1)); assertThat(result, hasItem(dave)); }
From source file:org.springframework.data.mongodb.core.geo.GeoSpatialTests.java
@Test public void withinCenter() { Circle circle = new Circle(-73.99171, 40.738868, 0.01); List<Venue> venues = template.find(query(where("location").within(circle)), Venue.class); assertThat(venues.size(), is(7));/*from w ww .ja v a 2s. c o m*/ }
From source file:org.springframework.data.mongodb.core.geo.GeoSpatialTests.java
@Test public void withinCenterSphere() { Circle circle = new Circle(-73.99171, 40.738868, 0.003712240453784); List<Venue> venues = template.find(query(where("location").withinSphere(circle)), Venue.class); assertThat(venues.size(), is(11));// w w w . jav a 2 s. com }