Google maps lädt nur einmal

Labrar

Aktives Mitglied
Thread Starter
Dabei seit
07.09.2004
Beiträge
129
Reaktionspunkte
3
Hallo.
Sorry, dass ich das ganze hier poste, da es sich zwar um eine APP (bzw. einen Appdesigner) handelt, nicht aber um eine native sondern eine Webapp.
Da ich aber auch keinerlei Javascriptfehler finde, denke ich doppelt, dass ich hier richtig bin. Vieleicht hatte ja schon ein anderer Enwstickler das Problem.

Problembeschreibung:

Also. Ich baue gerade an einem online App designer mit Kartenfunktion. Die eigene Geolocation ist noch nicht implementiert.
Wenn ich nun also diese App im Iphone öffne und mich zur Karte durchnavigiere wird diese beim ersten mal super geladen.
Gehe ich auf "Back" und dann wieder zur Karte wird diese (obwohl komplett neu geladen) nicht merh angezeigt.

Demoapp zum anschauen:
http://metalrain.de/appcry/test.php

Zum testen aus der ersten Auswahl bitte "Bars" wählen, dann "Hillbill Cocktails" und dann unten rechts auf "Map".
Ich weiß, dass die Buttons unten noch bescheiden aussehen. :)

Code zur Map
PHP:
$dat=date('YmdHis');
	if(is_numeric($_GET['lat']))**$ulat=$_GET['lat'];}else{$ulat='null';}
	if(is_numeric($_GET['long']))**$ulong=$_GET['long'];}else{$ulong='null';}
	$prz=$_GET['prz'];
	$id=$_GET['sid'];
	$w=$_GET['w'];
	$h=$_GET['h'];
	$sel=mysql_query("select * from ".CON." where id=".$id);
	$ray=mysql_fetch_assoc($sel);
	$rp=mysql_query("select * from ".START." where identer='".$ray['identer']."'");
 
 $rr=mysql_fetch_assoc($rp);
	?>
      
    
	<link href="<?php echo $ray['identer'];?>btn.css?<?php echo date('YmdHis');?>" media="screen" rel="stylesheet" type="text/css" >
<link href="<?php echo $ray['identer'];?>tab.css?<?php echo date('YmdHis');?>" media="screen" rel="stylesheet" type="text/css" >
<link href="<?php echo $ray['identer'];?>headfoot.css?<?php echo date('YmdHis');?>" media="screen" rel="stylesheet" type="text/css" >
    <style type="text/css">body{background-color:#FFFFFF; color:#000000; font-family:Arial, Helvetica, sans-serif;}</style>
    <script src="https://maps.googleapis.com/maps/api/js?map<?php echo $dat;?>&v=3.exp&sensor=false"></script> 
    <script type="text/javascript">
    
    
	
	var infos='<div class="info-window-content" style="color:#000000; font-size:12px;"><h4><?php echo $ray['title'];?></h4>';
	infos+='<div style="float:left; width:153px; height:89px;">';
	<?php if(file_exists($ray['colog']))**?>
	infos+='<img width="153" src="<?php echo $ray['colog'];?>"/>';
	<?php } ?>
	infos+='</div><div style="float:left; width:150px; padding:5px;">';
	infos+='<?php echo $ray['street'].'<br>'.$ray['plz'].' '.$ray['city'].'<br>';?>';
	infos+='</div></div>';
	</script>
    <div id="map_canvas" style="position:absolute; top:0px; left:0px; width:<?php echo $w;?>px; height:<?php echo ($h-$prz);?>px;"></div>
<script type="text/javascript">

var lat=<?php echo $ray['lat'];?>;var long=<?php echo $ray['lng'];?>;var lati=<?php echo $ulat;?>;var longi=<?php echo $ulong;?>;var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var st = new google.maps.LatLng(lati,longi);
var en = new google.maps.LatLng(lat,long);
var selection='DRIVING';

 function initialize<?php echo $dat;?>(lat,long,ula,ulo) **
 
  directionsDisplay = new google.maps.DirectionsRenderer();

var myInfoWindowOptions;
var infoWindow;
 var latlng = new google.maps.LatLng(lat, long);
 if(!isNaN(ula))**
  var ulatlng = new google.maps.LatLng(ula, ulo);
  }
    var myOptions = **
      zoom: 15,
      center: latlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP,
	  streetViewControl: true,
      disableDefaultUI: false,
      navigationControl: true,
      mapTypeControl: true,
      scaleControl: false

    };
    var map<?php echo $dat;?> = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	 directionsDisplay.setMap(map<?php echo $dat;?>);

	 var umyInfoWindowOptions = **
		content: '<div class="info-window-content" style="color:#000000; font-size:12px;"><h4>You are here</h4></div>',
		maxWidth: 100
	};
     myInfoWindowOptions = **
		content: infos,
		maxWidth: 550
	};
var marker = new google.maps.Marker(**
		draggable: false,
		raiseOnDrag: false,
		map: map<?php echo $dat;?>,
		position: latlng
	});
	if(!isNaN(ula))**
	var umarker = new google.maps.Marker(**
		draggable: false,
		raiseOnDrag: false,
		map: map<?php echo $dat;?>,
		position: ulatlng
	});
	}
	if(!isNaN(ula)){var uinfoWindow = new google.maps.InfoWindow(umyInfoWindowOptions);}
	google.maps.event.addListener(umarker, 'click', function() **
		infoWindow.open(map<?php echo $dat;?>,umarker);
	});
	if(!isNaN(ula)){uinfoWindow.open(map<?php echo $dat;?>,umarker);}
	infoWindow = new google.maps.InfoWindow(myInfoWindowOptions);
	google.maps.event.addListener(marker, 'click', function() **
		infoWindow.open(map<?php echo $dat;?>,marker);
	});
	infoWindow.open(map<?php echo $dat;?>,marker);
	calcRoute();
	var firsttime=false;
	google.maps.event.trigger(map<?php echo $dat;?>, "resize");
	google.maps.event.addListener(map<?php echo $dat;?>, 'idle', function() **
	if(!firsttime)**
		firsttime=true;
		window.parent.loaded=true;
	}
	
});
	
	 }
function calcRoute() **
 
  var request = **
      origin: st,
      destination: en,
      travelMode: google.maps.TravelMode[selection]
  };
  directionsService.route(request, function(response, status) **
    if (status == google.maps.DirectionsStatus.OK) **
	
      directionsDisplay.setDirections(response);
	  
    }
  });
}
function setRouter(how){if(how==1){selection='DRIVING'; calcRoute();}if(how==2){selection='WALKING'; calcRoute();}}
function callDiv()**
if(document.getElementById('map_canvas'))**
initialize<?php echo $dat;?>(lat,long,lati,longi);

}else{
setTimeout(function(){callDiv();},100);
}
}

callDiv();



</script>

</div>

<script type="text/javascript">
function check()**
if(!document.getElementById('map_canvas'))**
setTimeout(function(){check();},10);
}
}
check();
</script>
    
<div  class="footer" style="position:absolute; top:<?php echo ($h-$prz);?>px; left:0px; width:<?php echo $w;?>px; height:<?php echo round($prz);?>px; <?php if($ray['footerkind']==2)**?>background-image:url(<?php echo $rr['footerpic'];?>); <?php } ?> overflow:hidden;">
<?php if($ray['footerkind']==2 && $prz<100)**

?><img src="<?php echo $rr['footerpic'];?>" width="<?php echo $w;?>" style="position:absolute; top:0px; left:0px;" /> <?php } ?> 
<?php 
$fo=mysql_query("select * from ".ICON." where kind=1 and identer='".$ray['identer']."'");
$foray=mysql_fetch_assoc($fo);
setIcon(1,$foray,$prz,20,true);
?>
</div>

Danke fürs schauen und Tipps geben im vorraus :)
 
Kleines Update. Es scheint nur bei manchen Adressen so zu sein. Eine andere Adresse läuft gut.

Danke hat sich erledigt. Das Problem lag an einer anderen Stelle :)
 
Zuletzt bearbeitet:
Zurück
Oben Unten