/** * Writes a Polygon as GeoJSON. * * @param poly The polygon. * @param output The output. See {@link GeoJSONUtil#toWriter(Object)} for details. */ public void writePolygon(Polygon poly, Object output) throws IOException { encode(createPolygon(poly), 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 Polygon as GeoJSON. * * @param poly The polygon. * @param output The output. See {@link GeoJSONUtil#toWriter(Object)} for details. */ public void writePolygon(Polygon poly, Object output) throws IOException { encode(createPolygon(poly), output); }
return createPolygon((Polygon)geometry);