KMZ: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: 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...)
 
Zeile 15: Zeile 15:
 
  // Output the zip file, which includes the KML document
 
  // Output the zip file, which includes the KML document
 
  print ($myZip->file);
 
  print ($myZip->file);
 +
 +
[[Kategorie:Format]]

Version vom 19. November 2007, 10:29 Uhr

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);