How to convert KMZ to KML

A KMZ file is just a zipped KML file.

Rename the KMZ file with a .zip extension, then open it in your favorite ZIP program.

Here’s a bit of PHP to convert a KMZ file to KML:

<?php
$data = file_get_contents("http://example.com/some_file.kmz"); // url of the KMZ file
file_put_contents("/tmp/kmz_temp",$data);
ob_start();
passthru('unzip -p /tmp/kmz_temp');
$xml_data = ob_get_clean();
header("Content-type: text/xml");
echo $xml_data;
?> 

Done.


Faiq

Thank you, easy and unbelievable
cheers from Afghansitan

Leave a Reply
Your email will not be published