@Test public void testMultipleGeometries() throws Exception { Map<String, Object> json = loadJSONResource("featureCollectionMultipleGeometries.json"); CoordinateReferenceSystem crs84 = CRS.decode("EPSG:4326", true); SimpleFeatureType schema = GeoJSONSchemaDetector.getSchema(json, crs84); SimpleFeatureCollection fc = GeoJSONReader2.toFeatureCollection(json, schema); try (SimpleFeatureIterator it = fc.features()) { SimpleFeature f = it.hasNext() ? it.next() : null; assertFalse(it.hasNext()); assertNotNull(f); assertEquals("feature.0", f.getID()); WKTReader wkt = new WKTReader(); assertEquals(wkt.read("LINESTRING (1.1 1.2, 1.3 1.4)"), f.getAttribute("otherGeometry")); assertEquals(wkt.read("POINT (0.1 0.1)"), f.getDefaultGeometry()); } }
public static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema) { try { return toFeatureCollection(json, schema, null); } catch (MismatchedDimensionException | TransformException ignore) { throw new RuntimeException("Something bad happened"); } }
GeoJSONReader2 { public static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema) { try { return toFeatureCollection(json, schema, null); } catch (MismatchedDimensionException | TransformException ignore) { throw new RuntimeException("Something bad happened"); } } }
GeoJSONReader2 { public static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema) { try { return toFeatureCollection(json, schema, null); } catch (MismatchedDimensionException | TransformException ignore) { throw new RuntimeException("Something bad happened"); } }  }
GeoJSONReader2 { public static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema) { try { return toFeatureCollection(json, schema, null); } catch (MismatchedDimensionException | TransformException ignore) { throw new RuntimeException("Something bad happened"); } }  static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema); static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json,
            SimpleFeatureType schema, MathTransform transform); static SimpleFeature toFeature(Map<String, Object> json, SimpleFeatureType schema); static SimpleFeature toFeature(Map<String, Object> json, SimpleFeatureType schema,
            MathTransform transform); static Geometry toGeometry(Map<String, Object> geometry); static Point toPoint(Map<String, Object> geometry); static LineString toLineString(Map<String, Object> geometry); static Polygon toPolygon(Map<String, Object> geometry); static MultiPoint toMultiPoint(Map<String, Object> geometry); static MultiLineString toMultiLineString(Map<String, Object> geometry); static MultiPolygon toMultiPolygon(Map<String, Object> geometry); static GeometryCollection toGeometryCollection(Map<String, Object> geometry); }
GeoJSONReader2 { public static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema) { try { return toFeatureCollection(json, schema, null); } catch (MismatchedDimensionException | TransformException ignore) { throw new RuntimeException("Something bad happened"); } }  static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json, SimpleFeatureType schema); static SimpleFeatureCollection toFeatureCollection(Map<String, Object> json,
            SimpleFeatureType schema, MathTransform transform); static SimpleFeature toFeature(Map<String, Object> json, SimpleFeatureType schema); static SimpleFeature toFeature(Map<String, Object> json, SimpleFeatureType schema,
            MathTransform transform); static Geometry toGeometry(Map<String, Object> geometry); static Point toPoint(Map<String, Object> geometry); static LineString toLineString(Map<String, Object> geometry); static Polygon toPolygon(Map<String, Object> geometry); static MultiPoint toMultiPoint(Map<String, Object> geometry); static MultiLineString toMultiLineString(Map<String, Object> geometry); static MultiPolygon toMultiPolygon(Map<String, Object> geometry); static GeometryCollection toGeometryCollection(Map<String, Object> geometry);  }