public void writePlacemark ( XMLStreamWriter xmlOut , ResultSet rs , int geoFieldIndex , String spatialFieldName ) throws XMLStreamException , SQLException { xmlOut . writeStartElement ( "Placemark" ) ; if ( columnCount > 1 ) { writeExtendedData ( xmlOut , rs ) ; } StringBuilder sb = new StringBuilder ( ) ; Geometry geom = ( Geometry ) rs . getObject ( geoFieldIndex ) ; int inputSRID = geom . getSRID ( ) ; if ( inputSRID == 0 ) { throw new SQLException ( "A coordinate reference system must be set to save the KML file" ) ; } else if ( inputSRID != 4326 ) { throw new SQLException ( "The kml format supports only the WGS84 projection. \n" + "Please use ST_Transform(" + spatialFieldName + "," + inputSRID + ")" ) ; } KMLGeometry . toKMLGeometry ( geom , ExtrudeMode . NONE , AltitudeMode . NONE , sb ) ; //Write geometry xmlOut . writeCharacters ( sb . toString ( ) ) ; xmlOut . writeEndElement ( ) ; //Write Placemark }
A Placemark is a Feature with associated Geometry .