Is it possible to get PHP to:
- create a KML document and open it in GE
- continue immediately to create and open another KML document.
I am coding:
$kml = array('<?xml version="1.0" encoding="ISO-8859-1"?>');
$kml[] = '<kml xmlns="
http://www.opengis.net/kml/2.2">';
$kml[] = '<Document>';
// all the KML for the first document
$kml[] = '</Document>';
$kml[] = '</kml>';
$kmloutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmloutput;
$kml = array('<?xml version="1.0" encoding="ISO-8859-1"?>');
$kml[] = '<kml xmlns="
http://www.opengis.net/kml/2.2">';
$kml[] = '<Document>';
// all the KML for the second document
$kml[] = '</Document>';
$kml[] = '</kml>';
$kmloutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmloutput;
Instead of 'pausing' to open the first document, PHP adds the lines
for the second document to the end of the first document, so when it
eventually tries to open a document, GE complains that there's junk
after the first document element.
It all works fine if I opt to write each document file to disk, but
not when I ask PHP to open the two files in GE instead.