ich habe folgendes problem:
i have to geocode about 20000 adresses in germany in a little
education project, and i hoped to get it managed by this php-script,
that is published at developers.com by jason gilmore:
<?php
// Your Google Maps API key
$key = "i just dont want to send my key around, i put it in here";
// Connect to the MySQL database
$conn = mysql_connect("localhost", "root", "");
// Select the database
$db = mysql_select_db("eike");
// Query the table
$query = "SELECT id, address, zip FROM t2";
//echo $query;
$result = mysql_query($query) or die(mysql_error());
// Loop through each row, submit HTTP request, output coordinates
while (list($id, $address, $zip) = mysql_fetch_row($result))
{
$mapaddress = urlencode("$address $zip");
// Desired address
$url =
"http://maps.google.de/maps/geo?q=$mapaddress&output=xml&key=$key";
// Retrieve the URL contents
$page = file_get_contents($url);
// Parse the returned XML file
$xml = new SimpleXMLElement($page);
// Parse the coordinate string
list($longitude, $latitude, $altitude) = explode(",",
$xml->Response->Placemark->Point->coordinates);
// Output the coordinates
echo "latitude: $latitude, longitude: $longitude <br />";
}
?>
i do not understand why i do not get back anything except the last 3 or
4 columns of the script as result, the database is existing, the
webserver is up, whats wrong there ? do you have an idea ?
via www.maps.google.de its enough to enter street an zip for german
adresses, so i do not use other datafields as town or country.
i thank you for your answer, if there will be one
in deutsch: das srcipt tut nich, ich weiss nicht wieso, ich bekomme
immer die letzten 3-4 zeilen angezeigt, wenn ich es ausführe.
ich will mich nicht unbedingt auf dieses script festlegen, ne
alternative würde ich auch gerne versuchen, nur ist es mit meinen
programmierkenntnissen nicht sonderlich weit her
danke / thx for answers
eike