@Test public void parseMultiPolygon() throws Exception { List<List<double[]>> polys = (new GeoJSONParser( new ByteArrayInputStream( "[[ [[30, 20], [45, 40], [10, 40], [30, 20]]], [[[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]] ]]" .getBytes()), this.fType, null)) .parseMultiPolygonCoordinates(); double[] expPoly1 = {30.0f, 20.0f, 45.0f, 40.0f, 10.0f, 40.0f, 30.0f, 20.0f}; double[] expPoly2 = {15.0f, 5.0f, 40.0f, 10.0f, 10.0f, 20.0f, 5.0f, 10.0f, 15.0f, 5.0f}; assertArrayEquals(expPoly1, polys.get(0).get(0), 0.1f); assertArrayEquals(expPoly2, polys.get(1).get(0), 0.1f); }
public List<List<double[]>> parseMultiPolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<List<double[]>> polys = new ArrayList<List<double[]>>(); this.reader.beginArray(); while (this.reader.hasNext()) { polys.add(this.parsePolygonCoordinates()); } this.reader.endArray(); return polys; }
GeoJSONParser implements SimpleFeatureIterator { public List<List<double[]>> parseMultiPolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<List<double[]>> polys = new ArrayList<List<double[]>>(); this.reader.beginArray(); while (this.reader.hasNext()) { polys.add(this.parsePolygonCoordinates()); } this.reader.endArray(); return polys; } }
GeoJSONParser implements SimpleFeatureIterator { public List<List<double[]>> parseMultiPolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<List<double[]>> polys = new ArrayList<List<double[]>>(); this.reader.beginArray(); while (this.reader.hasNext()) { polys.add(this.parsePolygonCoordinates()); } this.reader.endArray(); return polys; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); }
GeoJSONParser implements SimpleFeatureIterator { public List<List<double[]>> parseMultiPolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<List<double[]>> polys = new ArrayList<List<double[]>>(); this.reader.beginArray(); while (this.reader.hasNext()) { polys.add(this.parsePolygonCoordinates()); } this.reader.endArray(); return polys; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); }
GeoJSONParser implements SimpleFeatureIterator { public List<List<double[]>> parseMultiPolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<List<double[]>> polys = new ArrayList<List<double[]>>(); this.reader.beginArray(); while (this.reader.hasNext()) { polys.add(this.parsePolygonCoordinates()); } this.reader.endArray(); return polys; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); static final String ENCODING; static final String DATETIME_FORMAT; static final String ERROR; static final String ERROR_CODE; static final String ERROR_MESSAGE; static final String ERROR_DETAILS; static final String GEOJSON_TYPE; static final String GEOJSON_TYPE_VALUE_FC; static final String GEOJSON_PROPERTIES; static final String GEOJSON_TOTALFEATURES; static final String FEATURES; static final String CRS; static final String CRS_TYPE; static final String CRS_TYPE_VALUE; static final String CRS_PROPERTIES; static final String CRS_PROPERTIES_NAME; static final String FEATURE_TYPE; static final String FEATURE_ID; static final String FEATURE_GEOMETRY; static final String FEATURE_GEOMETRY_TYPE; static final String FEATURE_TYPE_VALUE; static final String FEATURE_GEOMETRY_COORDINATES; static final String FEATURE_PROPERTIES; static final String GEOMETRY_POINT; static final String GEOMETRY_MULTIPOINT; static final String GEOMETRY_LINE; static final String GEOMETRY_MULTILINE; static final String GEOMETRY_POLYGON; static final String GEOMETRY_MULTIPOLYGON; }