Class KMLUtils

java.lang.Object
org.opengis.cite.kml22.util.KMLUtils

public class KMLUtils extends Object
Provides various utility methods for reading or manipulating KML and KMZ resources.
  • Constructor Details

    • KMLUtils

      public KMLUtils()
  • Method Details

    • extractKMLFromArchive

      public static Document extractKMLFromArchive(File file) throws IOException, SAXException
      Extracts the contents of the given ZIP archive and parses the first root-level KML document found within it. The main KML document is conventionally named doc.kml but this is not required; the .kml extension is expected, however.
      Parameters:
      file - A File object that presumably represents a KMZ file (ZIP archive).
      Returns:
      A KML document, or null if a root-level KML file could not be found in the archive.
      Throws:
      IOException - The file was not a valid ZIP archive or some other I/O error occurred.
      SAXException - If a KML document was found but it is not well-formed.
      See Also: