WKTWriter class
Writes the Well-Known Text representation of a {@link Geometry}. The Well-Known Text format is defined in the OGC Simple Features Specification for SQL. See {@link WKTReader} for a formal specification of the format syntax.
The WKTStringBuffer
outputs coordinates rounded to the precision
model. Only the maximum number of decimal places
necessary to represent the ordinates to the required precision will be
output.
The SFS WKT spec does not define a special tag for {@link LinearRing}s.
Under the spec, rings are output as LINESTRING
s.
In order to allow precisely specifying constructed geometries,
JTS also supports a non-standard LINEARRING
tag which is used
to output LinearRings.
@version 1.7 @see WKTReader
Constructors
- WKTWriter()
- Creates a WKTStringBuffer with default settings
- WKTWriter.withDimension(int outputDimension)
- Creates a writer that writes {@link Geometry}s with the given output dimension (2 to 4). The output follows the following rules:
Properties
- coordsPerLine ↔ int
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- indentTabStr ↔ String?
-
getter/setter pair
- isFormatted ↔ bool
-
getter/setter pair
- outputDimension ↔ int
-
getter/setter pair
-
outputOrdinates
↔ List<
Ordinate> -
getter/setter pair
- precisionModel ↔ PrecisionModel?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
appendGeometryCollectionTaggedText(
GeometryCollection geometryCollection, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
GeometryCollection
to <GeometryCollection Tagged Text> format, then appends it to the writer. -
appendGeometryCollectionText(
GeometryCollection geometryCollection, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
GeometryCollection
to <GeometryCollectionText> format, then appends it to the writer. -
appendGeometryTaggedText(
Geometry geometry, bool useFormatting, StringBuffer writer, NumberFormat formatter) → void -
Converts a
Geometry
to <Geometry Tagged Text> format, then appends it to the writer. -
appendGeometryTaggedText6Args(
Geometry geometry, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
Geometry
to <Geometry Tagged Text> format, then appends it to the writer. -
appendLinearRingTaggedText(
LinearRing linearRing, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
LinearRing
to <LinearRing Tagged Text> format, then appends it to the writer. -
appendLineStringTaggedText(
LineString lineString, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
LineString
to <LineString Tagged Text> format, then appends it to the writer. -
appendMultiLineStringTaggedText(
MultiLineString multiLineString, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiLineString
to <MultiLineString Tagged Text> format, then appends it to the writer. -
appendMultiLineStringText(
MultiLineString multiLineString, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiLineString
to <MultiLineString Text> format, then appends it to the writer. -
appendMultiPointTaggedText(
MultiPoint multipoint, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiPoint
to <MultiPoint Tagged Text> format, then appends it to the writer. -
appendMultiPointText(
MultiPoint multiPoint, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiPoint
to <MultiPoint Text> format, then appends it to the writer. -
appendMultiPolygonTaggedText(
MultiPolygon multiPolygon, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiPolygon
to <MultiPolygon Tagged Text> format, then appends it to the writer. -
appendMultiPolygonText(
MultiPolygon multiPolygon, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
MultiPolygon
to <MultiPolygon Text> format, then appends it to the writer. -
appendOrdinateText(
List< Ordinate> outputOrdinates, StringBuffer writer) → void - Appends additional ordinate information. This function may
-
appendPointTaggedText(
Point point, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
Coordinate
to <Point Tagged Text> format, then appends it to the writer. -
appendPolygonTaggedText(
Polygon polygon, List< Ordinate> outputOrdinates, bool useFormatting, int level, StringBuffer writer, NumberFormat formatter) → void -
Converts a
Polygon
to <Polygon Tagged Text> format, then appends it to the writer. -
appendPolygonText(
Polygon polygon, List< Ordinate> outputOrdinates, bool useFormatting, int level, bool indentFirst, StringBuffer writer, NumberFormat formatter) → void -
Converts a
Polygon
to <Polygon Text> format, then appends it to the writer. -
appendSequenceText(
CoordinateSequence seq, List< Ordinate> outputOrdinates, bool useFormatting, int level, bool indentFirst, StringBuffer writer, NumberFormat formatter) → void -
Appends all members of a
CoordinateSequence
to the stream. Each {@code Coordinate} is separated from another using a colon, the ordinates of a {@code Coordinate} are separated by a space. -
getOutputOrdinates(
) → List< Ordinate> - Gets a bit-pattern defining which ordinates should be @return an ordinate bit-pattern @see #setOutputOrdinates(List)
-
indent(
bool useFormatting, int level, StringBuffer writer) → void -
indentCoords(
bool useFormatting, int coordIndex, int level, StringBuffer writer) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setFormatted(
bool isFormatted) → void - Sets whether the output will be formatted.
-
setMaxCoordinatesPerLine(
int coordsPerLine) → void - Sets the maximum number of coordinates per line written in formatted output. If the provided coordinate number is <= 0, coordinates will be written all on one line.
-
setOutputOrdinates(
List< Ordinate> outputOrdinates) → void - Sets the {@link Ordinate} that are to be written. Possible members are:
-
setPrecisionModel(
PrecisionModel precisionModel) → void - Sets a {@link PrecisionModel} that should be used on the ordinates written.
-
setTab(
int size) → void - Sets the tab size to use for indenting.
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
Geometry geometry) → String -
Converts a
Geometry
to its Well-known Text representation. -
writeFormatted(
Geometry geometry) → String -
Same as
write
, but with newlines and spaces to make the well-known text more readable. -
writeFormatted4Args(
Geometry geometry, bool useFormatting, StringBuffer writer, PrecisionModel? precisionModel) → void -
Converts a
Geometry
to its Well-known Text representation. -
writeFormattedWithStringBuffer(
Geometry geometry, StringBuffer writer) → void -
Same as
write
, but with newlines and spaces to make the well-known text more readable. -
writeWithStringBuffer(
Geometry geometry, StringBuffer writer) → void -
Converts a
Geometry
to its Well-known Text representation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- INDENT → int
-
final
- OUTPUT_DIMENSION → int
-
final
Static Methods
-
appendCoordinate(
CoordinateSequence seq, List< Ordinate> outputOrdinates, int i, StringBuffer writer, NumberFormat formatter) → void - Appends the i'th coordinate from the sequence to the writer
-
createFormatter(
PrecisionModel precisionModel) → NumberFormat -
Creates the
NumberFormat
used to writedouble
s with a sufficient number of decimal places. -
stringOfChar(
String ch, int count) → String -
Returns a
String
of repeated characters. -
toLineString(
List< Coordinate> coord) → String - Generates the WKT for a LINESTRING specified by a {@link CoordinateSequence}.
-
toLineStringFromCoords(
Coordinate p0, Coordinate p1) → String - Generates the WKT for a LINESTRING specified by two {@link Coordinate}s.
-
toLineStringFromSequence(
CoordinateSequence seq) → String - Generates the WKT for a LINESTRING specified by a {@link CoordinateSequence}.
-
toPoint(
Coordinate p0) → String - Generates the WKT for a POINT specified by a {@link Coordinate}.
-
writeNumber(
double d, NumberFormat formatter) → String -
Converts a
double
to aString
, not in scientific notation.