Package org.matsim.vis.kml
Class KMZWriter
- java.lang.Object
-
- org.matsim.vis.kml.KMZWriter
-
- All Implemented Interfaces:
MatsimSomeWriter
public class KMZWriter extends Object implements MatsimSomeWriter
A writer for complex keyhole markup files used by Google Earth. It supports packing multiple kml-files into one zip-compressed file which can directly be read by Google Earth. The files will have the ending *.kmz.- Author:
- mrieser
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNonKMLFile(byte[] data, String inZipFilename)
Adds a file (in form of a byte array) to a kml file.void
addNonKMLFile(InputStream data, String inZipFilename)
Adds some data as a file to the kmz.void
addNonKMLFile(String filename, String inZipFilename)
Adds a file to the kmz which is not a kml file.void
close()
Closes this file for writing.void
writeLinkedKml(String filename, net.opengis.kml.v_2_2_0.KmlType kml)
Adds the specified KML-object to the file.void
writeMainKml(net.opengis.kml.v_2_2_0.KmlType kml)
Writes the specified KML-object as the main kml into the file.
-
-
-
Method Detail
-
writeLinkedKml
public void writeLinkedKml(String filename, net.opengis.kml.v_2_2_0.KmlType kml)
Adds the specified KML-object to the file.- Parameters:
filename
- The internal filename of this kml-object in the kmz-file. Other kml-objects in the same kmz-file can reference this kml with the specified filename.kml
- The KML-object to store in the file.
-
writeMainKml
public void writeMainKml(net.opengis.kml.v_2_2_0.KmlType kml)
Writes the specified KML-object as the main kml into the file. The main kml is the one Google Earth reads when the file is opened. It should contain NetworkLinks to the other KMLs stored in the same file.- Parameters:
kml
- the KML-object that will be read by Google Earth when opening the file.
-
close
public void close()
Closes this file for writing.
-
addNonKMLFile
public void addNonKMLFile(String filename, String inZipFilename) throws IOException
Adds a file to the kmz which is not a kml file.- Parameters:
filename
- the path to the file, relative or absoluteinZipFilename
- the filename used for the file in the kmz file- Throws:
IOException
-
addNonKMLFile
public void addNonKMLFile(InputStream data, String inZipFilename) throws IOException
Adds some data as a file to the kmz. The data stream will be closed at the end of the method.- Parameters:
data
- the data to add to the kmzinZipFilename
- the filename used for the file in the kmz file- Throws:
IOException
-
addNonKMLFile
public void addNonKMLFile(byte[] data, String inZipFilename) throws IOException
Adds a file (in form of a byte array) to a kml file.- Parameters:
data
-inZipFilename
- inZipFilename the filename used for the file in the kmz file- Throws:
IOException
-
-