List of usage examples for org.springframework.data.mongodb.core.geo GeoJsonMultiPolygon GeoJsonMultiPolygon
public GeoJsonMultiPolygon(List<GeoJsonPolygon> polygons)
From source file:org.springframework.data.mongodb.core.geo.GeoJsonModuleUnitTests.java
/** * @see DATAMONGO-1181/*from w w w.java2s. c o m*/ */ @Test public void shouldDeserializeGeoJsonMultiPolygonCorrectly() throws JsonParseException, JsonMappingException, IOException { String json = "{ \"type\": \"Polygon\", \"coordinates\": [" + "[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]]," + "[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]," + "[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]"// + "]}"; assertThat(mapper.readValue(json, GeoJsonMultiPolygon.class), is(new GeoJsonMultiPolygon(Arrays.asList( new GeoJsonPolygon(Arrays.asList(new Point(102, 2), new Point(103, 2), new Point(103, 3), new Point(102, 3), new Point(102, 2))), new GeoJsonPolygon(Arrays.asList(new Point(100, 0), new Point(101, 0), new Point(101, 1), new Point(100, 1), new Point(100, 0))), new GeoJsonPolygon(Arrays.asList(new Point(100.2, 0.2), new Point(100.8, 0.2), new Point(100.8, 0.8), new Point(100.2, 0.8), new Point(100.2, 0.2))))))); }