Class KMLWriter
Writes a formatted string containing the KML representation of a JTS Geometry. The output is KML fragments which can be substituted wherever the KML Geometry abstract element can be used.
Inherited Members
Namespace: NetTopologySuite.IO.KML
Assembly: NetTopologySuite.dll
Syntax
public class KMLWriter
Remarks
Output elements are indented to provide a nicely-formatted representation. An output line prefix and maximum number of coordinates per line can be specified.
Constructors
| Edit this page View SourceKMLWriter()
Declaration
public KMLWriter()
Fields
| Edit this page View SourceAltitudeModeAbsolute
The KML standard value absolute
for use in AltitudeMode.
Declaration
public const string AltitudeModeAbsolute = "absolute"
Field Value
Type | Description |
---|---|
string |
AltitudeModeClampToGround
The KML standard value clampToGround
for use in AltitudeMode.
Declaration
public const string AltitudeModeClampToGround = "clampToGround "
Field Value
Type | Description |
---|---|
string |
AltitudeModeRelativeToGround
The KML standard value relativeToGround
for use in AltitudeMode.
Declaration
public const string AltitudeModeRelativeToGround = "relativeToGround "
Field Value
Type | Description |
---|---|
string |
Properties
| Edit this page View SourceAltitudeMode
The value output in the altitudeMode
element.
Declaration
public string AltitudeMode { get; set; }
Property Value
Type | Description |
---|---|
string |
Extrude
The flag to be output in the extrude
element.
Declaration
public bool Extrude { get; set; }
Property Value
Type | Description |
---|---|
bool |
LinePrefix
A tag string which is prefixed to every emitted text line. This can be used to indent the geometry text in a containing document.
Declaration
public string LinePrefix { get; set; }
Property Value
Type | Description |
---|---|
string |
MaxCoordinatesPerLine
The maximum number of coordinates to output per line.
Declaration
public int MaxCoordinatesPerLine { get; set; }
Property Value
Type | Description |
---|---|
int |
Precision
The maximum number of decimal places to output in ordinate values. Useful for limiting output size.
Declaration
public int Precision { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
negative values set the precision to Floating, like standard behavior.
Tesselate
The flag to be output in the tesselate
element.
Declaration
public bool Tesselate { get; set; }
Property Value
Type | Description |
---|---|
bool |
Z
The Z value to be output for all coordinates. This overrides any Z value present in the Geometry coordinates.
Declaration
public double Z { get; set; }
Property Value
Type | Description |
---|---|
double |
Methods
| Edit this page View SourceWrite(Geometry)
Writes a Geometry in KML format as a string.
Declaration
public string Write(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | the geometry to write |
Returns
Type | Description |
---|---|
string | a string containing the KML geometry representation |
Write(Geometry, TextWriter)
Writes the KML representation of a Geometry to a TextWriter.
Declaration
public void Write(Geometry geom, TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | the geometry to write |
TextWriter | writer | the writer to write to |
Write(Geometry, StringBuilder)
Appends the KML representation of a Geometry to a StringBuilder.
Declaration
public void Write(Geometry geom, StringBuilder sb)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | the geometry to write |
StringBuilder | sb | the buffer to write into |
WriteGeometry(Geometry, double)
Writes a Geometry as KML to a string, using a specified Z value.
Declaration
public static string WriteGeometry(Geometry geometry, double z)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | the geometry to write |
double | z | the Z value to use |
Returns
Type | Description |
---|---|
string | a string containing the KML geometry representation |
WriteGeometry(Geometry, double, int, bool, string)
Writes a Geometry as KML to a string, using a specified Z value, precision, extrude flag, and altitude mode code.
Declaration
public static string WriteGeometry(Geometry geometry, double z, int precision, bool extrude, string altitudeMode)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | the geometry to write |
double | z | the Z value to use |
int | precision | the maximum number of decimal places to write |
bool | extrude | the extrude flag to write |
string | altitudeMode | the altitude model code to write |
Returns
Type | Description |
---|---|
string | a string containing the KML geometry representation |