@Test public void testFeatureWithRegularGeometryAttributeReadAndGeometryAfterProperties() throws Exception { String geojson1 = "{" + " 'type': 'Feature'," + " 'id': 'feature.0'," + " 'properties': {" + " 'otherGeometry': {" + " 'type': 'LineString'," + " 'coordinates': [[1.1, 1.2], [1.3, 1.4]]" + " }" + " }," + " 'geometry': {" + " 'type': 'Point'," + " 'coordinates': [0.1, 0.1]" + " }" + "}"; geojson1 = geojson1.replace('\'', '"'); SimpleFeature f = GeoJSONReader.parseFeature(geojson1); assertNotNull(f); assertNotNull(f); assertEquals("features.0", f.getID()); WKTReader wkt = new WKTReader(); assertEquals(wkt.read("POINT (0.1 0.1)"), f.getDefaultGeometry()); assertEquals(wkt.read("LINESTRING (1.1 1.2, 1.3 1.4)"), f.getAttribute("otherGeometry")); }
public static SimpleFeature parseFeature(String json) throws JsonParseException, IOException { try (JsonParser lParser = factory.createParser(new ByteArrayInputStream(json.getBytes()))) { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JtsModule()); ObjectNode node = mapper.readTree(lParser); try (GeoJSONReader reader = new GeoJSONReader((InputStream) null)) { SimpleFeature feature = reader.getNextFeature(node); return feature; } } }
GeoJSONReader implements AutoCloseable { public static SimpleFeature parseFeature(String json) throws JsonParseException, IOException { try (JsonParser lParser = factory.createParser(new ByteArrayInputStream(json.getBytes()))) { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JtsModule()); ObjectNode node = mapper.readTree(lParser); try (GeoJSONReader reader = new GeoJSONReader((InputStream) null)) { SimpleFeature feature = reader.getNextFeature(node); return feature; } } } }
GeoJSONReader implements AutoCloseable { public static SimpleFeature parseFeature(String json) throws JsonParseException, IOException { try (JsonParser lParser = factory.createParser(new ByteArrayInputStream(json.getBytes()))) { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JtsModule()); ObjectNode node = mapper.readTree(lParser); try (GeoJSONReader reader = new GeoJSONReader((InputStream) null)) { SimpleFeature feature = reader.getNextFeature(node); return feature; } } } GeoJSONReader(URL url);  GeoJSONReader(InputStream is); }
GeoJSONReader implements AutoCloseable { public static SimpleFeature parseFeature(String json) throws JsonParseException, IOException { try (JsonParser lParser = factory.createParser(new ByteArrayInputStream(json.getBytes()))) { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JtsModule()); ObjectNode node = mapper.readTree(lParser); try (GeoJSONReader reader = new GeoJSONReader((InputStream) null)) { SimpleFeature feature = reader.getNextFeature(node); return feature; } } } GeoJSONReader(URL url);  GeoJSONReader(InputStream is); boolean isConnected(); static SimpleFeature parseFeature(String json); FeatureCollection getFeatures(); FeatureIterator<SimpleFeature> getIterator(); FeatureType getSchema(); void setSchema(SimpleFeatureType schema); boolean isSchemaChanged(); void setSchemaChanged(boolean schemaChanged); @Override void close(); }
GeoJSONReader implements AutoCloseable { public static SimpleFeature parseFeature(String json) throws JsonParseException, IOException { try (JsonParser lParser = factory.createParser(new ByteArrayInputStream(json.getBytes()))) { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JtsModule()); ObjectNode node = mapper.readTree(lParser); try (GeoJSONReader reader = new GeoJSONReader((InputStream) null)) { SimpleFeature feature = reader.getNextFeature(node); return feature; } } } GeoJSONReader(URL url);  GeoJSONReader(InputStream is); boolean isConnected(); static SimpleFeature parseFeature(String json); FeatureCollection getFeatures(); FeatureIterator<SimpleFeature> getIterator(); FeatureType getSchema(); void setSchema(SimpleFeatureType schema); boolean isSchemaChanged(); void setSchemaChanged(boolean schemaChanged); @Override void close(); static final String GEOMETRY_NAME; }