| | | | |
| |||||||
| JavaScript, Ajax und mehr dynamisches Scripten und Interaktion auf Clientebene |
|
| | LinkBack | Themen-Optionen | Thema bewerten |
| | |
| Erfahrener Benutzer Registriert seit: 16.07.2008
Beiträge: 145
![]() | Hallo Leute, ich versuche über folgendes Skript Google Maps mit Informationen zur Adress über eine Datenbank zu befüllen. Die Angabe der addAdress stehen, so denke ich zumindest an der richtigen Stelle. Jedoch erscheint auf meinem Bildschirm keine Karte mit Markern. Könntet ihr euch das bitte mal ansehen und mir sagen, was dran falsch ist, bzw. ob vielleicht Attribute fehlen. DANKE Code: <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="XHTML namespace"> <head> <script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=" type="text/javascript"></script> <script> //<![CDATA[ var map; var geocoder; function initialize() { if (GBrowserIsCompatible()) { geocoder = new GClientGeocoder(); map = new GMap2(document.getElementById("map")); geocoder.getLatLng( function(point) { if (!point) { alert("Adress not found"); } else { map.setCenter(point, 11); map.addControl(new GLargeMapControl()); var marker = new GMarker(point); map.addOverlay(marker); } } ); <?php include("_include/config.inc.php"); $db = mysql_connect($host, $user, $pass); $res = mysql_db_query($dbase, "select plz as zipcode, ort as city, land as country from wasser_sammeln where plz != '' and land != '' and ort != ''"); $num = mysql_num_rows($res); while($row = mysql_fetch_object($res)) { echo "addAddress('".$row->zipcode." ".$row->city.", ".$row->country."');\n"; } ?> } } function addAddress(address) { geocoder.getLatLng( address, function(point) { if (point) { var marker = new GMarker(point); map.addOverlay(marker); } } ); } //]]> </script> </head> <body onload="initialize()" onunload="GUnload()"> <div id="map" style="width: 800px; height: 500px"></div> </body> </html> |
| | |
| | |
| PHP Code Flüsterer Registriert seit: 21.08.2005 Beiträge: 4682 PHP-Kenntnisse: Fortgeschritten | |
| | |
| Erfahrener Benutzer Registriert seit: 16.07.2008
Beiträge: 145
![]() | Du, ich kann zwar absolut nicht behaupten, dass ich weiß wie es geht, aber zumindest kann ich sagen, dass mir dein Code schon sehr weitergeholfen hat. Er hat mir zwar ständig den ALERT angezeigt, aber den habe ich abgeschalten. Anscheinend gibt es aber Probleme, mit eingetragenen Postleitzahlen, gerade von GB usw. aber damit kann ich eigentlich leben. Denn ich kann nicht jede eingetragenen überprüfen. Das einzige was mich stört ist, dass wenn man den Browser aktualisiert er manchmal keine Karte anzeigt, dann wieder mal einen Scriptfehler bringt und dann wieder die Karte mit den Markern anzeigt. Hier der Code: Code: <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script
src="http://maps.google.com/maps?file=api&v=2&sensor=true&key="
type="text/javascript"></script>
<script>
//<![CDATA[
var map;
var geocoder;
function initialize()
{
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
geocoder = new GClientGeocoder();
geocoder.getLatLng(
'86494 Emersacker, Deutschland',
function(point)
{
if (point) {
map.setCenter(point, 6);
}
}
);
map.setUIToDefault();
map.setMapType(G_SATELLITE_MAP);
<?php
include("_include/config.inc.php");
$db = mysql_connect($host, $user, $pass);
$res = mysql_db_query($dbase, "select plz, ort, land from wasser_sammeln where plz != '' and land != '' and ort != ''");
$num = mysql_num_rows($res);
while($row = mysql_fetch_object($res))
{
$plz = plz;
$ort = ort;
$land = land;
echo "addAddress('".$row->plz." ".$row->ort.", ".$row->land."');\n";
}
?>
}
}
function addAddress(address)
{
geocoder.getLatLng(
address,
function(point)
{
if (point) {
var marker = new GMarker(point);
map.addOverlay(marker);
} else {
;
}
}
);
}
//]]>
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map" style="width: 800px; height: 500px"></div>
</body>
</html>
DANKE |
| | |
|
| Themen-Optionen | |
| Thema bewerten | |
|
|
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Hilfe: datenbank mappen und kopieren | M*I*B | Datenbanken | 29 | 15.02.2012 21:55 |
| Google Maps werden im IE6/IE7 nicht komplett dargestellt | Timo | JavaScript, Ajax und mehr | 2 | 16.05.2009 17:56 |
| Google maps einbinden | de_Joerg | JavaScript, Ajax und mehr | 3 | 20.09.2008 17:55 |
| Google Maps oder Microsoft Maps als Tool einbinden | solitaer | PHP-Fortgeschrittene | 3 | 01.07.2008 05:07 |
| GMapper - Google Maps mit PHP | Dave Waterstone | PHP-Fortgeschrittene | 1 | 17.05.2008 16:51 |
| Google Maps / body onload | imported_nighT | HTML, Usability und Barrierefreiheit | 2 | 23.02.2008 21:06 |
| Google Maps API | cycap | HTML, Usability und Barrierefreiheit | 5 | 25.11.2007 15:16 |
| Google Maps API - Erfahrungen? | Plague | PHP Tipps 2006 | 1 | 17.08.2006 12:13 |
| Google Sitemaps Fehler!? | Frank Burian | PHP-Fortgeschrittene | 2 | 25.04.2006 15:03 |
| google Ergebnis in PHP auswerten | dh1sbg | PHP-Fortgeschrittene | 4 | 12.11.2005 22:21 |
| Google "verarzchen" mit PHP !? | Beitragsarchiv | 31 | 18.09.2005 22:07 | |
| Mehrere Anwendungen eine Datenbank... | Datenbanken | 5 | 15.08.2005 11:22 | |
| mysql datenbank anlegen...aber WIE??? | Datenbanken | 0 | 05.08.2005 19:33 | |
| [Erledigt] mysql datenbank anlegen...aber WIE??? | PHP Tipps 2005-2 | 0 | 05.08.2005 19:33 | |
| mysql datenbank anlegen...aber WIE??? | Datenbanken | 0 | 05.08.2005 19:32 | |
| Besucher kamen über folgende Suchanfragen bei Google auf diese Seite |
| http://www.php.de/javascript-ajax-und-mehr/58123-erledigt-google-maps-api-datenbank.html, google maps marker aus datenbank, google maps api datenbank, google map mehrere adressen aus datenbank, api datenbank, google maps datenbank, google maps marker datenbank, google api key localhost, postleitzahlen datenbank, google maps einbinden, php google maps, php einbinden von google maps auf localhost, google map datenbank, function initialize() { if (gbrowseriscompatible()) {, google maps sensor, google api plz, google maps api datenbank speichern, google maps aus datenbank php, php script google map datenbank, google maps localhost key |