Class WKTWriter
java.lang.Object
org.apache.sedona.common.S2Geography.WKTWriter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(org.locationtech.jts.geom.Coordinate p) EnumSet<org.locationtech.jts.io.Ordinate>Gets a bit-pattern defining which ordinates should bevoidsetFormatted(boolean isFormatted) Sets whether the output will be formatted.voidsetMaxCoordinatesPerLine(int coordsPerLine) Sets the maximum number of coordinates per line written in formatted output.voidsetOutputOrdinates(EnumSet<org.locationtech.jts.io.Ordinate> outputOrdinates) Sets theOrdinatethat are to be written.voidsetPrecisionModel(org.locationtech.jts.geom.PrecisionModel precisionModel) Sets aPrecisionModelthat should be used on the ordinates written.voidsetTab(int size) Sets the tab size to use for indenting.static StringtoPoint(org.locationtech.jts.geom.Coordinate p0) Generates the WKT for a POINT specified by aCoordinate.Converts aGeometryto its Well-known Text representation.voidConverts ageographyto its Well-known Text representation.voidCheck if need to write SRID
-
Constructor Details
-
WKTWriter
public WKTWriter()Creates a new WKTWriter with default settings -
WKTWriter
public WKTWriter(boolean isEwkt) -
WKTWriter
public WKTWriter(int outputDimension) Creates a writer that writesGeographys with the given output dimension (2 to 4). The output follows the following rules:- If the specified output dimension is 3 and the z is measure flag is set to
true, the Z value of coordinates will be written if it is present (i.e. if it is not
Double.NaN) - If the specified output dimension is 3 and the z is measure flag is set to
false, the Measure value of coordinates will be written if it is present (i.e. if it
is not
Double.NaN) - If the specified output dimension is 4, the Z value of coordinates will be written
even if it is not present when the Measure value is present. The Measure value of
coordinates will be written if it is present (i.e. if it is not
Double.NaN)
setOutputOrdinates(EnumSet)- Parameters:
outputDimension- the coordinate dimension to output (2 to 4)
- If the specified output dimension is 3 and the z is measure flag is set to
true, the Z value of coordinates will be written if it is present (i.e. if it is not
-
-
Method Details
-
toPoint
Generates the WKT for a POINT specified by aCoordinate.- Parameters:
p0- the point coordinate- Returns:
- the WKT
-
format
-
setFormatted
public void setFormatted(boolean isFormatted) Sets whether the output will be formatted.- Parameters:
isFormatted- true if the output is to be formatted
-
setMaxCoordinatesPerLine
public void setMaxCoordinatesPerLine(int coordsPerLine) 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.- Parameters:
coordsPerLine- the number of coordinates per line to output.
-
setTab
public void setTab(int size) Sets the tab size to use for indenting.- Parameters:
size- the number of spaces to use as the tab string- Throws:
IllegalArgumentException- if the size is non-positive
-
setOutputOrdinates
Sets theOrdinatethat are to be written. Possible members are:Ordinate.XOrdinate.YOrdinate.ZOrdinate.M
Ordinate.XandOrdinate.Yare always assumed and not particularly checked for.- Parameters:
outputOrdinates- A set ofOrdinatevalues
-
getOutputOrdinates
Gets a bit-pattern defining which ordinates should be- Returns:
- an ordinate bit-pattern
- See Also:
-
setPrecisionModel
public void setPrecisionModel(org.locationtech.jts.geom.PrecisionModel precisionModel) Sets aPrecisionModelthat should be used on the ordinates written.If none/
nullis assigned, the precision model of theGeometry.getFactory()is used.Note: The precision model is applied to all ordinate values, not just x and y.
- Parameters:
precisionModel- the flag indicating ifCoordinate.z/{} is actually a measure value.
-
write
Converts aGeometryto its Well-known Text representation.- Parameters:
geography- aGeometryto process- Returns:
- a <Geometry Tagged Text> string (see the OpenGIS Simple Features Specification)
-
write
Converts ageographyto its Well-known Text representation.- Parameters:
geography- ageographyto process- Throws:
IOException
-
writeSRID
Check if need to write SRID- Throws:
IOException
-