KMZ

Aus Geoinformation HSR
Version vom 19. November 2007, 10:30 Uhr von Stefan (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Keyhole Markup Language (KML) gzipped.

KMZ ist mehr als gzipping: "You actually have to generate a ZIP format catalog which containts a KML document. Just use your favourite tool to add your KML document to a ZIP file, then rename the ZIP file to KMZ. Google Earth client appears to store the internal KML document as doc.kml, but seems to happily read the first KML document it finds in the KMZ file, regardless of name."

Damit können auch statische Bilder einmal mitgeschickt werden ohne sie ständig neu laden zu müssen. "The problem comes when you want to reduce bandwidth by sending KMZ documents from a script in response to a NetworkLink."

In PHP, nehme man das PEAR module (writing to ZIP files) oder man suche Google (q=zip.inc.php) nach "zip.lib.php", um folgendes programmieren zu können:

// Instantiate the zipfile
$myZip = new zipfile;
// Add your carefully crafted KML data to the zipfile (in memory)
$myZip->addFile($strKMLContent,"doc.kml");
// Send the appropriate content type for KMZ
header('Content-Type: application/vnd.google-earth.kmz');
// Output the zip file, which includes the KML document
print ($myZip->file);