Package org.h2gis.functions.io.kml

# Class KMLWriterDriver

java.lang.Object
org.h2gis.functions.io.kml.KMLWriterDriver

public class KMLWriterDriver extends Object
KML writer

Author:
  Erwan Bocher

## Constructor Summary

Constructors
Constructor
Description
`KMLWriterDriver(Connection connection, File fileName, String encoding, boolean deleteFile)`

## Method Summary

Modifier and Type
Method
Description
`void`
`write(String tableName, org.h2gis.api.ProgressVisitor progress)`
Write spatial table or sql query to kml or kmz file format.
`void`
`writeExtendedData(XMLStreamWriter xmlOut, ResultSet rs)`
The ExtendedData element offers three techniques for adding custom data to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay, ScreenOverlay, Document, Folder).
`void`
`writePlacemark(XMLStreamWriter xmlOut, ResultSet rs, String geomField)`
A Placemark is a Feature with associated Geometry.Syntax : `<Placemark id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link href=" "/> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal --> <phoneNumber>...</phoneNumber> <!-- string --> <Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Placemark element --> <Geometry>...</Geometry> </Placemark>`
`void`
`writeSimpleData(XMLStreamWriter xmlOut, String columnName, String value)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### KMLWriterDriver

public KMLWriterDriver(Connection connection, File fileName, String encoding, boolean deleteFile)

## Method Details

### write

public void write(String tableName, org.h2gis.api.ProgressVisitor progress) throws SQLException, IOException
Write spatial table or sql query to kml or kmz file format.

Parameters:
  `tableName` - the name of table or a select query
  `progress` - progress monitor
Throws:
  `SQLException`
  `IOException`

### writePlacemark

public void writePlacemark(XMLStreamWriter xmlOut, ResultSet rs, String geomField) throws XMLStreamException, SQLException
A Placemark is a Feature with associated Geometry.Syntax : `<Placemark id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link href=" "/> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal --> <phoneNumber>...</phoneNumber> <!-- string --> <Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Placemark element --> <Geometry>...</Geometry> </Placemark>`

Parameters:
  `xmlOut` -
  `rs` -
  `geomField` -
Throws:
  `XMLStreamException`
  `SQLException`

### writeExtendedData

public void writeExtendedData(XMLStreamWriter xmlOut, ResultSet rs) throws XMLStreamException, SQLException
The ExtendedData element offers three techniques for adding custom data to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay, ScreenOverlay, Document, Folder). These techniques are Adding untyped data/value pairs using the Data element (basic) Declaring new typed fields using the Schema element and then instancing them using the SchemaData element (advanced) Referring to XML elements defined in other namespaces by referencing the external namespace within the KML file (basic) These techniques can be combined within a single KML file or Feature for different pieces of data. Syntax : `<ExtendedData> <Data name="string"> <displayName>...</displayName> <!-- string --> <value>...</value> <!-- string --> </Data> <SchemaData schemaUrl="anyURI"> <SimpleData name=""> ... </SimpleData> <!-- string --> </SchemaData> <namespace_prefix:other>...</namespace_prefix:other> </ExtendedData>`

Parameters:
  `xmlOut` -
Throws:
  `XMLStreamException`
  `SQLException`

### writeSimpleData

public void writeSimpleData(XMLStreamWriter xmlOut, String columnName, String value) throws XMLStreamException

Parameters:
  `xmlOut` -
Throws:
  `XMLStreamException`