Package org.openstreetmap.josm.io
Class GeoJSONWriter
java.lang.Object
org.openstreetmap.josm.io.GeoJSONWriter
- Direct Known Subclasses:
GeoJSONMapRouletteWriter
Writes OSM data as a GeoJSON string, using JSR 353: Java API for JSON Processing (JSON-P).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classConvert a primitive to a json object(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataSetprotected static final jakarta.json.spi.JsonProviderUsed to avoid many calls toJsonProvider.provider()ingetCoorArray(JsonArrayBuilder, EastNorth).(package private) static final StringThis is used to determine that a tag should be interpreted as a json object or array.(package private) static final StringThis is used to determine that a tag should be interpreted as a json object or array.private final EnumSet<GeoJSONWriter.Options>private static final Projectionprivate static final BooleanPropertyprivate static final BooleanProperty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendBounds(Bounds b, jakarta.json.JsonObjectBuilder object) protected voidappendLayerBounds(DataSet ds, jakarta.json.JsonObjectBuilder object) protected voidappendLayerFeatures(DataSet ds, jakarta.json.JsonObjectBuilder object) protected voidappendPrimitive(OsmPrimitive p, jakarta.json.JsonArrayBuilder array) private static jakarta.json.JsonValueconvertValueToJson(String value) private static jakarta.json.JsonArrayBuildergetCoorArray(jakarta.json.JsonArrayBuilder builder, EastNorth c) private jakarta.json.JsonArrayBuildergetCoorArray(jakarta.json.JsonArrayBuilder builder, ILatLon c) (package private) voidsetOptions(GeoJSONWriter.Options... options) Set the options for this writer.write()Writes OSM data as a GeoJSON string (prettified).write(boolean pretty) Writes OSM data as a GeoJSON string (prettified or not).voidWrites OSM data as a GeoJSON string (prettified or not).
-
Field Details
-
data
-
projection
-
SKIP_EMPTY_NODES
-
UNTAGGED_CLOSED_IS_POLYGON
-
JSON_PROVIDER
Used to avoid many calls toJsonProvider.provider()ingetCoorArray(JsonArrayBuilder, EastNorth). For validating Mesa County, CO, this reduces CPU and memory usage ofwrite()by ~80%. By using this for otherJsoncalls,write()takes ~95% less resources than the original. And the entire process takes 1/4 of the time (38 minutes → <10 minutes).For more details, see JSONP #346.
-
processedMultipolygonWays
-
options
-
JSON_VALUE_START_MARKER
This is used to determine that a tag should be interpreted as a json object or array. The tag should have bothJSON_VALUE_START_MARKERandJSON_VALUE_END_MARKER.- See Also:
-
JSON_VALUE_END_MARKER
This is used to determine that a tag should be interpreted as a json object or array. The tag should have bothJSON_VALUE_START_MARKERandJSON_VALUE_END_MARKER.- See Also:
-
-
Constructor Details
-
GeoJSONWriter
Constructs a newGeoJSONWriter.- Parameters:
ds- The OSM data set to save- Since:
- 12806
-
-
Method Details
-
setOptions
Set the options for this writer. SeeGeoJSONWriter.Options.- Parameters:
options- The options to set.
-
write
Writes OSM data as a GeoJSON string (prettified).- Returns:
- The GeoJSON data
-
write
Writes OSM data as a GeoJSON string (prettified or not).- Parameters:
pretty-trueto have pretty output,falseotherwise- Returns:
- The GeoJSON data
- Since:
- 6756
-
write
Writes OSM data as a GeoJSON string (prettified or not).- Parameters:
pretty-trueto have pretty output,falseotherwisewriter- The writer used to write results
-
getCoorArray
private jakarta.json.JsonArrayBuilder getCoorArray(jakarta.json.JsonArrayBuilder builder, ILatLon c) -
getCoorArray
private static jakarta.json.JsonArrayBuilder getCoorArray(jakarta.json.JsonArrayBuilder builder, EastNorth c) -
appendPrimitive
-
convertValueToJson
-
appendLayerBounds
-
appendBounds
-
appendLayerFeatures
-