You can export part of a map to a KML (or KMZ) file using
the Map Export API (see
Map Export API).
To do so, set an
IlvKMLExporter as the vectorial exporter on the
IlvMapExportManager. You can also use the raster exporter, if you want
to export an overlaid image.
If you set a KML file name, all images
used inside that file are saved at the same location, with names such
as image0.png.
If you set a file name that ends with .kmz
,
all the files are compressed into a single kmz
file:
IlvMapExportManager exportManager = new IlvMapExportManager();
IlvKMLExporter KMLExporter = new IlvKMLExporter();
exportManager.setVectorialExporter(KMLExporter);
exportManager.setRasterExporter(KMLExporter);
// Configure KML export (file name).
KMLExporter.setFileName("export.kml");
// Set the region of the map to export.
exportManager.setExportRegion(-Math.PI,-Math.PI/2, Math.PI,Math.PI/2);
// Export selected map layers of the map.
IlvMapLayer mapLayersToExport[]={/* table of map layers to export*/...};
exportManager.exportMapLayers(mapLayersToExport);