/** * Writes a GeometryCollection as GeoJSON. * * @param gcol The geometry collection. * @param output The output. See {@link GeoJSONUtil#toWriter(Object)} for details. */ public void writeGeometryCollection(GeometryCollection gcol, Object output) throws IOException { encode(createGeometryCollection(gcol), output); }
Map<String, Object> create(Geometry geometry) { if (geometry instanceof Point) { return createPoint((Point) geometry); } if (geometry instanceof LineString) { return createLine((LineString) geometry); } if (geometry instanceof Polygon) { return createPolygon((Polygon) geometry); } if (geometry instanceof MultiPoint) { return createMultiPoint((MultiPoint) geometry); } if (geometry instanceof MultiLineString) { return createMultiLine((MultiLineString) geometry); } if (geometry instanceof MultiPolygon) { return createMultiPolygon((MultiPolygon) geometry); } if (geometry instanceof GeometryCollection) { return createGeometryCollection((GeometryCollection) geometry); } throw new IllegalArgumentException("Unable to encode object " + geometry); }
/** * Writes a GeometryCollection as GeoJSON. * * @param gcol The geometry collection. * @param output The output. See {@link GeoJSONUtil#toWriter(Object)} for details. */ public void writeGeometryCollection(GeometryCollection gcol, Object output) throws IOException { encode(createGeometryCollection(gcol), output); }
return createGeometryCollection((GeometryCollection)geometry);