com.mongodb.client.model.geojson.Point Java Examples
The following examples show how to use
com.mongodb.client.model.geojson.Point.
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: GeoWithinQueriesWithPolygonTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindCitiesInTheUK() { // given Polygon uk = new Polygon(asList(new Position(49.78, -10.5), new Position(49.78, 1.78), new Position(59, 1.78), new Position(59, -10.5), new Position(49.78, -10.5))); City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); getDs().save(manchester); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); getDs().save(sevilla); getDs().ensureIndexes(); // when List<City> citiesInTheUK = getDs().find(City.class) .filter(geoWithin("location", uk)).iterator().toList(); // then assertThat(citiesInTheUK.size(), is(2)); assertThat(citiesInTheUK, contains(london, manchester)); }
Example #2
Source File: GeoWithinQueriesWithMultiPolygonTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindCitiesInEurope() { City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); getDs().save(manchester); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); getDs().save(sevilla); City newYork = new City("New York", new Point(new Position(40.75981395319104, -73.98302106186748))); getDs().save(newYork); getDs().ensureIndexes(); // when List<City> citiesInTheUK; citiesInTheUK = getDs().find(City.class) .filter(geoWithin("location", europeanCountries)).iterator().toList(); // then assertThat(citiesInTheUK.size(), is(3)); assertThat(citiesInTheUK, containsInAnyOrder(london, manchester, sevilla)); }
Example #3
Source File: GeoIntersectsQueriesWithPolygonTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindAPointThatLiesInAQueryPolygon() { // given City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); getDs().save(manchester); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.4057731, -5.966287))); getDs().save(sevilla); getDs().ensureIndexes(); // when List<City> matchingCity = getDs().find(City.class) .filter(geoIntersects("location", new Polygon(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202), new Position(37.40759155713022, -5.964911067858338))))).iterator().toList(); // then assertThat(matchingCity.size(), is(1)); assertThat(matchingCity.get(0), is(sevilla)); }
Example #4
Source File: GeoQueriesTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindCitiesCloseToAGivenPointWithinARadiusOfMeters() { // given double latitude = 51.5286416; double longitude = -0.1015987; Datastore datastore = getDs(); City london = new City("London", new Point(new Position(latitude, longitude))); datastore.save(london); City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); datastore.save(manchester); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); datastore.save(sevilla); getDs().ensureIndexes(); // when List<City> cities = datastore.find(City.class) .filter(near("location", new Point(new Position(latitude, longitude))) .maxDistance(200000.0)).iterator() .toList(); // then assertThat(cities.size(), is(1)); assertThat(cities.get(0), is(london)); }
Example #5
Source File: GeoIntersectsQueriesWithLineTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindAPointThatLiesOnTheQueryLine() { // given LineString spanishLine = new LineString(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.3753708, -5.9550582))); City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); getDs().save(manchester); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); getDs().save(sevilla); getDs().ensureIndexes(); // when MongoCursor<City> matchingCity = getDs().find(City.class) .filter(geoIntersects("location", spanishLine)).iterator(); // then assertThat(matchingCity.next(), is(sevilla)); assertFalse(matchingCity.hasNext()); }
Example #6
Source File: MorphiaQuery.java From morphia with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("removal") public CriteriaContainer within(final Shape shape) { Filter converted; if (shape instanceof dev.morphia.query.Shape.Center) { final dev.morphia.query.Shape.Center center = (dev.morphia.query.Shape.Center) shape; converted = Filters.center(getField(), center.getCenter(), center.getRadius()); } else if (shape.getGeometry().equals("$box")) { Point[] points = shape.getPoints(); converted = Filters.box(getField(), points[0], points[1]); } else if (shape.getGeometry().equals("$polygon")) { converted = Filters.polygon(getField(), shape.getPoints()); } else { throw new UnsupportedOperationException(Sofia.conversionNotSupported(shape.getGeometry())); } if (isNot()) { converted.not(); } filter(converted); return MorphiaQuery.this; }
Example #7
Source File: GeoIntersectsQueriesWithPointTest.java From morphia with Apache License 2.0 | 6 votes |
@Test public void shouldFindAPointThatExactlyMatchesTheQueryPoint() { // given Point coordsOfManchester = new Point(new Position(53.4722454, -2.2235922)); City manchester = new City("Manchester", coordsOfManchester); getDs().save(manchester); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); getDs().save(sevilla); getDs().ensureIndexes(); // when List<City> matchingCity = getDs().find(City.class) .filter(geoIntersects("location", coordsOfManchester)).iterator().toList(); // then assertThat(matchingCity.size(), is(1)); assertThat(matchingCity.get(0), is(manchester)); }
Example #8
Source File: PolygonFilter.java From morphia with Apache License 2.0 | 6 votes |
@Override public void encode(final Mapper mapper, final BsonWriter writer, final EncoderContext context) { writer.writeStartDocument(field(mapper)); writer.writeStartDocument("$geoWithin"); writer.writeStartArray("$polygon"); for (final Point point : points) { writer.writeStartArray(); for (final Double value : point.getPosition().getValues()) { writer.writeDouble(value); } writer.writeEndArray(); } writer.writeEndArray(); writer.writeEndDocument(); writer.writeEndDocument(); }
Example #9
Source File: CenterFilter.java From morphia with Apache License 2.0 | 6 votes |
@Override public void encode(final Mapper mapper, final BsonWriter writer, final EncoderContext context) { writer.writeStartDocument(field(mapper)); writer.writeStartDocument("$geoWithin"); writer.writeStartArray(getFilterName()); Point center = getValue(); writer.writeStartArray(); for (final Double value : center.getPosition().getValues()) { writer.writeDouble(value); } writer.writeEndArray(); writer.writeDouble(radius); writer.writeEndArray(); writer.writeEndDocument(); writer.writeEndDocument(); }
Example #10
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 6 votes |
@Test public void testNearMaxDistance() { getDs().getMapper().map(Place.class); getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); FindOptions options = new FindOptions() .logQuery() .limit(1); Query<Place> query = getDs().find(Place.class) .filter(near("loc", new Point(new Position(1, 1))) .maxDistance(2.0)); Place found = query.iterator(options).tryNext(); Assert.assertNotNull(getDs().getLoggedQuery(options), found); final Place notFound = getDs().find(Place.class) .filter(near("loc", new Point(new Position(0, 0))) .maxDistance(1.0)).iterator(options) .tryNext(); Assert.assertNull(getDs().getLoggedQuery(options), notFound); }
Example #11
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinOutsideBox() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(box("loc", new Point(new Position(0, 0)), new Point(new Position(.4, .5)))).iterator(new FindOptions().limit(1)) .tryNext(); Assert.assertNull(found); }
Example #12
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test(expected = MongoQueryException.class) public void testNearNoIndex() { final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); Place found = getDs().find(Place.class) .filter(near("loc", new Point(new Position(0, 0)))).iterator(new FindOptions().limit(1)) .tryNext(); Assert.assertNull(found); }
Example #13
Source File: CodecStructureTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testGeoNear() { evaluate(parse("{ $geoNear: { near: { type: 'Point', coordinates: [ -73.98142 , 40.71782 ] }, key: 'location', distanceField: " + "'dist.calculated', query: { 'category': 'Parks' } } }"), to(new Point(new Position(-73.98142, 40.71782))) .key("location") .distanceField("dist.calculated") .query(eq("category", "Parks"))); }
Example #14
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinRadiusSphere() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(centerSphere("loc", new Point(new Position(0, 1)), 1)).iterator(new FindOptions().limit(1)) .next(); Assert.assertNotNull(found); }
Example #15
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinRadius2() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(center("loc", new Point(new Position(0.5, 0.5)), 0.77)).iterator(new FindOptions().limit(1)) .next(); Assert.assertNotNull(found); }
Example #16
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinRadius() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(center("loc", new Point(new Position(0, 1)), 1.1)).iterator(new FindOptions().limit(1)) .next(); Assert.assertNotNull(found); }
Example #17
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinOutsideRadius() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(center("loc", new Point(new Position(2, 2)), 0.4)).iterator(new FindOptions().limit(1)) .tryNext(); Assert.assertNull(found); }
Example #18
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindNearAPoint() { // given Datastore datastore = getDs(); City london = new City("London", new Point(new Position(51.5286416, -0.1015987))); datastore.save(london); City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); datastore.save(manchester); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); datastore.save(sevilla); getDs().ensureIndexes(); final Point searchPoint = new Point(new Position(50, 0.1278)); List<City> cities = datastore.find(City.class) .filter(near("location", searchPoint).maxDistance(200000.0)).iterator().toList(); assertThat(cities.size(), is(1)); assertThat(cities.get(0), is(london)); cities = datastore.find(City.class) .filter(near("location", searchPoint).maxDistance(200000D)).iterator().toList(); assertThat(cities.size(), is(1)); assertThat(cities.get(0), is(london)); assertThat(datastore.find(City.class) .filter(near("location", searchPoint) .maxDistance(200000D) .minDistance(195000D)).iterator().toList().size(), is(0)); assertThat(datastore.find(City.class) .filter(nearSphere("location", searchPoint) .maxDistance(200000D) .minDistance(195000D)).iterator().toList().size(), is(0)); }
Example #19
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testWithinBox() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(box("loc", new Point(new Position(0, 0)), new Point(new Position(2, 2)))).iterator(new FindOptions().limit(1)) .next(); Assert.assertNotNull(found); }
Example #20
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testGeoWithinPolygon2() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{10, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(polygon("loc", new Point(new Position(0, 0)), new Point(new Position(0, 5)), new Point(new Position(2, 3)), new Point(new Position(2, 0)))).iterator(new FindOptions().limit(1)) .tryNext(); Assert.assertNull(found); }
Example #21
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@Test public void testGeoWithinBox() { getDs().ensureIndexes(); final Place place1 = new Place("place1", new double[]{1, 1}); getDs().save(place1); final Place found = getDs().find(Place.class) .filter(box("loc", new Point(new Position(0, 0)), new Point(new Position(2, 2)))) .iterator(new FindOptions().limit(1)) .next(); Assert.assertNotNull(found); }
Example #22
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindRoutesOrderedByDistanceFromAGivenPoint() { // given Route sevilla = new Route("Spain", new LineString(asList(new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202)))); getDs().save(sevilla); Route newYork = new Route("New York", new LineString(asList(new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193)))); getDs().save(newYork); Route london = new Route("London", new LineString(asList(new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425)))); getDs().save(london); getDs().ensureIndexes(); // when List<Route> routes = getDs().find(Route.class) .filter(near("route", new Point(new Position(51.5286416, -0.1015987)))).iterator() .toList(); // then assertThat(routes.size(), is(3)); assertThat(routes.get(0), is(london)); assertThat(routes.get(1), is(sevilla)); assertThat(routes.get(2), is(newYork)); }
Example #23
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindRoutesCloseToAGivenPointWithinARadiusOfMeters() { // given Route sevilla = new Route("Spain", new LineString(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202)))); getDs().save(sevilla); Route newYork = new Route("New York", new LineString(asList( new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193)))); getDs().save(newYork); Route london = new Route("London", new LineString(asList( new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425)))); getDs().save(london); getDs().ensureIndexes(); // when List<Route> routes = getDs().find(Route.class) .filter(near("route", new Point(new Position(51.5286416, -0.1015987))) .maxDistance(20000.0)).iterator() .toList(); // then assertThat(routes.size(), is(1)); assertThat(routes.get(0), is(london)); }
Example #24
Source File: GeoJsonIndexTest.java From morphia with Apache License 2.0 | 5 votes |
@Test(expected = Exception.class) public void shouldErrorWhenCreatingA2dIndexOnGeoJson() { // given Place pointB = new Place(new Point(new Position(3.1, 7.5)), "Point B"); getDs().save(pointB); // when getDs().ensureIndexes(); //"location object expected, location array not in correct format", code : 13654 }
Example #25
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindCitiesOrderedByDistance() { double latitudeLondon = 51.5286416; double longitudeLondon = -0.1015987; City manchester = new City("Manchester", new Point(new Position(53.4722454, -2.2235922))); getDs().save(manchester); City london = new City("London", new Point(new Position(latitudeLondon, longitudeLondon))); getDs().save(london); City sevilla = new City("Sevilla", new Point(new Position(37.3753708, -5.9550582))); getDs().save(sevilla); getDs().ensureIndexes(); List<City> cities = getDs().find(City.class) .filter(near("location", new Point(new Position(latitudeLondon, longitudeLondon)))).iterator() .toList(); assertThat(cities.size(), is(3)); assertThat(cities.get(0), is(london)); assertThat(cities.get(1), is(manchester)); assertThat(cities.get(2), is(sevilla)); cities = getDs().find(City.class) .filter(nearSphere("location", new Point(new Position(latitudeLondon, longitudeLondon)))).iterator() .toList(); assertThat(cities.size(), is(3)); assertThat(cities.get(0), is(london)); assertThat(cities.get(1), is(manchester)); assertThat(cities.get(2), is(sevilla)); }
Example #26
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindAreasOrderedByDistanceFromAGivenPoint() { // given Area sevilla = new Area("Spain", new Polygon(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202), new Position(37.40759155713022, -5.964911067858338)))); getDs().save(sevilla); Area newYork = new Area("New York", new Polygon(asList( new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193), new Position(40.75981395319104, -73.98302106186748)))); getDs().save(newYork); Area london = new Area("London", new Polygon(asList( new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425), new Position(51.507780365645885, -0.21786745637655258)))); getDs().save(london); getDs().ensureIndexes(); // when List<Area> routesOrderedByDistanceFromLondon = getDs().find(Area.class) .filter(near("area", new Point(new Position(51.5286416, -0.1015987)))) .iterator() .toList(); // then assertThat(routesOrderedByDistanceFromLondon.size(), is(3)); assertThat(routesOrderedByDistanceFromLondon.get(0), is(london)); assertThat(routesOrderedByDistanceFromLondon.get(1), is(sevilla)); assertThat(routesOrderedByDistanceFromLondon.get(2), is(newYork)); }
Example #27
Source File: GeoNearQueriesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindAreasCloseToAGivenPointWithinARadiusOfMeters() { // given Area sevilla = new Area("Spain", new Polygon(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202), new Position(37.40759155713022, -5.964911067858338)))); getDs().save(sevilla); Area newYork = new Area("New York", new Polygon(asList( new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193), new Position(40.75981395319104, -73.98302106186748)))); getDs().save(newYork); Area london = new Area("London", new Polygon(asList( new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425), new Position(51.507780365645885, -0.21786745637655258)))); getDs().save(london); getDs().ensureIndexes(); // when List<Area> routesOrderedByDistanceFromLondon = getDs().find(Area.class) .filter(near("area", new Point(new Position(51.5286416, -0.1015987))) .maxDistance(20000.0)).iterator() .toList(); // then assertThat(routesOrderedByDistanceFromLondon.size(), is(1)); assertThat(routesOrderedByDistanceFromLondon.get(0), is(london)); }
Example #28
Source File: GeoIntersectsQueriesWithPointTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindRoutesThatAGivenPointIsOn() { // given Route sevilla = new Route("Spain", new LineString(asList( new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202)))); getDs().save(sevilla); Route newYork = new Route("New York", new LineString(asList( new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193)))); getDs().save(newYork); Route london = new Route("London", new LineString(asList( new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425)))); getDs().save(london); Route londonToParis = new Route("London To Paris", new LineString(asList( new Position(51.5286416, -0.1015987), new Position(48.858859, 2.3470599)))); getDs().save(londonToParis); getDs().ensureIndexes(); // when List<Route> routeContainingPoint = getDs().find(Route.class) .filter(geoIntersects("route", new Point(new Position(37.40759155713022, -5.964911067858338)))).iterator() .toList(); // then assertThat(routeContainingPoint.size(), is(1)); assertThat(routeContainingPoint.get(0), is(sevilla)); }
Example #29
Source File: GeoIntersectsQueriesWithPointTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldFindAreasWhereTheGivenPointIsOnTheBoundary() { // given Area sevilla = new Area("Spain", new Polygon(asList(new Position(37.40759155713022, -5.964911067858338), new Position(37.40341208875179, -5.9643941558897495), new Position(37.40297396667302, -5.970452763140202), new Position(37.40759155713022, -5.964911067858338)))); getDs().save(sevilla); Area newYork = new Area("New York", new Polygon(asList(new Position(40.75981395319104, -73.98302106186748), new Position(40.7636824529618, -73.98049869574606), new Position(40.76962974853814, -73.97964206524193), new Position(40.75981395319104, -73.98302106186748)))); getDs().save(newYork); Area london = new Area("London", new Polygon(asList(new Position(51.507780365645885, -0.21786745637655258), new Position(51.50802478194237, -0.21474729292094707), new Position(51.5086863655597, -0.20895397290587425), new Position(51.507780365645885, -0.21786745637655258)))); getDs().save(london); getDs().ensureIndexes(); // when List<Area> areaContainingPoint = getDs().find(Area.class) .filter(geoIntersects("area", new Point(new Position(51.507780365645885, -0.21786745637655258)))).iterator() .toList(); // then assertThat(areaContainingPoint.size(), is(1)); assertThat(areaContainingPoint.get(0), is(london)); }
Example #30
Source File: GeoEntitiesTest.java From morphia with Apache License 2.0 | 5 votes |
@Test public void shouldRetrieveGeoJsonPoint() { // given City city = new City("New City", new Point(new Position(3.0, 7.0))); getDs().save(city); // when City found = getDs().find(City.class) .filter(eq("name", "New City")).iterator(new FindOptions().limit(1)) .tryNext(); // then assertThat(found, is(notNullValue())); assertThat(found, is(city)); }