use of com.mongodb.client.model.geojson.PolygonCoordinates in project mongo-java-driver by mongodb.
the class GeometryEncoderHelper method encodeMultiPolygon.
private static void encodeMultiPolygon(final BsonWriter writer, final MultiPolygon value) {
writer.writeStartArray();
for (PolygonCoordinates polygonCoordinates : value.getCoordinates()) {
encodePolygonCoordinates(writer, polygonCoordinates);
}
writer.writeEndArray();
}
use of com.mongodb.client.model.geojson.PolygonCoordinates in project spring-data-mongodb by spring-projects.
the class MongoTemplateMappingTests method writesAndReadsEntityWithOpenNativeMongoGeoJsonTypesCorrectly.
// DATAMONGO-2357
@Test
public void writesAndReadsEntityWithOpenNativeMongoGeoJsonTypesCorrectly() {
WithOpenMongoGeoJson source = new WithOpenMongoGeoJson();
source.id = "id-2";
source.geometry = new MultiPolygon(Arrays.asList(new PolygonCoordinates(Arrays.asList(new Position(0, 0), new Position(0, 1), new Position(1, 1), new Position(1, 0), new Position(0, 0)))));
template1.save(source);
assertThat(template1.findOne(query(where("id").is(source.id)), WithOpenMongoGeoJson.class)).isEqualTo(source);
}
Aggregations