public class GeoJSONWriter extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
GeoJSONWriter.GeometryPrimitiveVisitor |
Modifier and Type | Field and Description |
---|---|
private OsmDataLayer |
layer |
private Projection |
projection |
private static boolean |
skipEmptyNodes |
Constructor and Description |
---|
GeoJSONWriter(OsmDataLayer layer,
Projection projection)
Constructs a new
GeoJSONWriter . |
Modifier and Type | Method and Description |
---|---|
protected void |
appendBounds(Bounds b,
javax.json.JsonObjectBuilder object) |
protected void |
appendLayerBounds(DataSet ds,
javax.json.JsonObjectBuilder object) |
protected void |
appendLayerFeatures(DataSet ds,
javax.json.JsonObjectBuilder object) |
protected void |
appendPrimitive(OsmPrimitive p,
javax.json.JsonArrayBuilder array) |
private static javax.json.JsonArrayBuilder |
getCoorArray(javax.json.JsonArrayBuilder builder,
EastNorth c) |
private javax.json.JsonArrayBuilder |
getCoorArray(javax.json.JsonArrayBuilder builder,
LatLon c) |
java.lang.String |
write()
Writes OSM data as a GeoJSON string (prettified).
|
java.lang.String |
write(boolean pretty)
Writes OSM data as a GeoJSON string (prettified or not).
|
private final OsmDataLayer layer
private final Projection projection
private static final boolean skipEmptyNodes
public GeoJSONWriter(OsmDataLayer layer, Projection projection)
GeoJSONWriter
.layer
- The OSM data layer to saveprojection
- The projection to use for coordinatespublic java.lang.String write()
public java.lang.String write(boolean pretty)
pretty
- true
to have pretty output, false
otherwiseprivate javax.json.JsonArrayBuilder getCoorArray(javax.json.JsonArrayBuilder builder, LatLon c)
private static javax.json.JsonArrayBuilder getCoorArray(javax.json.JsonArrayBuilder builder, EastNorth c)
protected void appendPrimitive(OsmPrimitive p, javax.json.JsonArrayBuilder array)
protected void appendLayerBounds(DataSet ds, javax.json.JsonObjectBuilder object)
protected void appendBounds(Bounds b, javax.json.JsonObjectBuilder object)
protected void appendLayerFeatures(DataSet ds, javax.json.JsonObjectBuilder object)