Blog

Latest News and Updates

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.

dtbakerHow to convert KMZ to KML
Share this post

1 comment

Join the conversation
  • Faiq - June 2, 2013 reply

    Thank you, easy and unbelievable
    cheers from Afghansitan

Join the conversation