@Test public void testGeoShapeGeometryCollection() throws JsonParseException, JsonMappingException, IOException { rgb.setNumGeometries(5); GeometryCollection geom = rgb.createRandomGeometryCollection(); assertTrue(parserUtil.createGeometry(rgb.toMap(geom)).equalsExact(geom, 1e-9)); }
@Test public void testGeoShapePointString() throws JsonParseException, JsonMappingException, IOException { Point geom = rgb.createRandomPoint(); final Map<String, Object> map = new HashMap<>(); final List<String> coords = new ArrayList<>(); coords.add(String.valueOf(geom.getX())); coords.add(String.valueOf(geom.getY())); map.put("coordinates", coords); map.put("type", "Point"); assertTrue(parserUtil.createGeometry(map).equalsExact(geom, 1e-9)); }
@Test public void testGeoShapeEnvelope() throws JsonParseException, JsonMappingException, IOException { Envelope envelope = rgb.createRandomEnvelope(); Geometry expected = geometryFactory.toGeometry(envelope); assertTrue(parserUtil.createGeometry(rgb.toMap(envelope)).equalsExact(expected, 1e-9)); }
@Test public void testGeoShapeMultiPolygon() throws JsonParseException, JsonMappingException, IOException { MultiPolygon geom = rgb.createRandomMultiPolygon(); assertTrue(parserUtil.createGeometry(rgb.toMap(geom)).equalsExact(geom, 1e-9)); }
@Test public void testGeoShapeLineString() throws JsonParseException, JsonMappingException, IOException { LineString geom = rgb.createRandomLineString(); assertTrue(parserUtil.createGeometry(rgb.toMap(geom)).equalsExact(geom, 1e-9)); }