geometryJSON.write(gf.createMultiPoint(coords), sw); LOG.debug("done"); } else if (output.equals(SIsochrone.RESULT_TYPE_SHED)) { geometryJSON.write(circleShape, sw); } else { if (maxTime > shedCalcMethodSwitchTimeInSec) { // eg., walkshed > 20 min geometryJSON.write(outputHull, sw); LOG.debug("done"); geometryJSON.write(pathToStreet, sw); } else { mls = gf.createMultiLineString(edges); LOG.debug("write geom"); geometryJSON.write(mls, sw); LOG.debug("done"); geometryJSON.write(mls, sw); LOG.debug("done");
/** * Writes a Geometry instance as GeoJSON returning the result as a string. * * @param geometry The geometry. * @return The geometry encoded as GeoJSON */ public String toString(Geometry geometry) { StringWriter w = new StringWriter(); try { write(geometry, w); return w.toString(); } catch (IOException e) { throw new RuntimeException(e); } }
public static void write(Object obj, Object output) throws IOException { if (obj instanceof Geometry) { gjson.write((Geometry) obj, output); } else if (obj instanceof Feature || obj instanceof FeatureCollection || obj instanceof CoordinateReferenceSystem) { if (obj instanceof SimpleFeature) { fjson.writeFeature((SimpleFeature) obj, output); } else if (obj instanceof FeatureCollection) { fjson.writeFeatureCollection((FeatureCollection) obj, output); } else if (obj instanceof CoordinateReferenceSystem) { fjson.writeCRS((CoordinateReferenceSystem) obj, output); } else { throw new IllegalArgumentException( "Unable able to encode object of type " + obj.getClass()); } } } }
/** * Writes a Geometry instance as GeoJSON returning the result as a string. * * @param geometry The geometry. * * @return The geometry encoded as GeoJSON */ public String toString(Geometry geometry) { StringWriter w = new StringWriter(); try { write(geometry, w); return w.toString(); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void encode(Object value, OutputStream os) throws IOException { GeometryJSON json = new GeometryJSON(); json.write((Geometry) value, os); }
public static void write(Object obj, Object output) throws IOException { if (obj instanceof Geometry) { gjson.write((Geometry)obj, output); } else if (obj instanceof Feature || obj instanceof FeatureCollection || obj instanceof CoordinateReferenceSystem) { if (obj instanceof SimpleFeature) { fjson.writeFeature((SimpleFeature)obj, output); } else if (obj instanceof FeatureCollection) { fjson.writeFeatureCollection((FeatureCollection)obj, output); } else if (obj instanceof CoordinateReferenceSystem) { fjson.writeCRS((CoordinateReferenceSystem)obj, output); } else { throw new IllegalArgumentException("Unable able to encode object of type " + obj.getClass()); } } } }
new GeometryJSON().write(g, tempFile);