hi all,
I am trying to render my postgis database into GE (the latest release contains an "askml()" function), but it seems like I have some trouble with my php code. here are my kml and php:
networkLink.kml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<NetworkLink id="colza">
<!-- inherited from Feature element -->
<name>Colza</name> <!-- string -->
<visibility>1</visibility> <!-- boolean -->
<open>1</open> <!-- boolean -->
<description>Colza U-PSUD geographical Database</description> <!-- string -->
<Link>
<href>http://127.0.0.1/pgis2ge/colza2ge.php</href>
</Link>
<refreshVisibility>0</refreshVisibility> <!-- boolean -->
<flyToView>1</flyToView> <!-- boolean -->
</NetworkLink>
</Document>
</kml>
php file:
Code:
<?php
$con = pg_connect("host=localhost port=5432 dbname=colza user=xxx pasword=xxx");
$req = "SELECT id_pop,champ,asKml(geom) FROM populations where geom is not null and numpoints(geom)<=5";
$kml="";
foreach ($res as $row){
if ($row["champ"]=="t")
$type_pop = "Champ";
else
$type_pop = "Population hors champ";
$kml .= "<Placemark><name>id_pop ".$row["id_pop"]."</name><description>".$type_pop."</description>".$row["askml"]."</Placemark>";
}
$kml .= "</Document></kml>";
echo $kml;
pg_close($con);
?>
The askml() SQL returns something like this:
Code:
<LineString><coordinates>1.24424554235467,47.7351038733263,0 1.24424554235467,47.7351038733263,0</coordinates></LineString>
when I launch the kml file, GE returns this error: (traduced from french, sorry if the message is not very right)
extracting networlink failed
missing or erroneous file root element
Can anyone see what is wrong?
thanks in advance.
Guiguite.