Yes, I checked the onload() in <body> section it is
correct I think :
<body onLoad="load()" onunload="GUnload()">
However the php script called in the :
echo '<script type=\"text/javascript\" src=\"".GEO_URL_ROOT."/get/
gmaps.php?r=".$routeObj->id."\"></script>';
I think it can have some error look at ---
GMaps.php
<?php
include_once('overall.php');
require_once('./core/geodb.class.php');
require_once('./core/georoute.class.php');
function div($n) //division, for the number of points is less than
$max
{
$max = 400;
$div = 1;
while(1)
{
if(($n/$div) < $max) return $div;
else $div++;
}
}
$database = new GeoDB;
$database->geoDB();
$route = new Route;
$route->fromPoints($points);
$n = count($points);
$d = div($n);
$c = 0;
if($n > 0){
//choose the best zoom
$varArray = explode(',',$points);
$points = $database-
>getPointsById($_GET['r']);
foreach($points as $pp)
{
$lats[] = $pp->lat; $lngs[] = $pp->lng;}
$diflat = max($lats)-min($lats);
$diflng = max($lngs)-min($lngs);
if($diflat>1 || $diflng>1) $zoom = 8;
elseif($diflat>1 || $diflng>1) $zoom = 9;
elseif($diflat>0.5 || $diflng>0.5) $zoom = 10;
elseif($diflat>0.3 || $diflng>0.3) $zoom = 11;
elseif($diflat>0.1 || $diflng>0.1) $zoom = 12;
elseif($diflat>0.05 || $diflng>0.05) $zoom = 13;
else $zoom = 14;
//make request
echo <----- this echo calls a javascript
function "GMaps.newmap" "GMaps.newmap(".(array_sum($route-
>lats)/$n).",".(array_sum($route->lngs)/$n).",".$zoom."); \n";
echo "GMaps.polyline(["; <----- another
javascript function ...
echo '['.$points[0]->lat.','.$points[0]->lng.']';//first point
for($i = $d; $i < $n; $i += $d){
echo ',['.$points[$i]->lat.','.$points[$i]->lng.']';
}
echo "]);\n";
echo "GMaps.marker(".$points[0]->lat.",".$points[0]-
>lng.",'start','Start route');\n";
}
if(count($spots)>0)
{
$varArray = explode(',',$spots);
$spots = $database->getSpotsById($_GET['r']);
foreach($spots as $s){
echo
"GMaps.marker(".$s->lat.",".$s->lng.",'spot','".$s->name."');
\n";
}
}
if(count($near)>0)
{
$varArray = explode(',',$near);
$near = $database->getNearNamesById($_GET['r'],20);
foreach($near as $n){
echo
"GMaps.marker(".$n->lat.",".$n->lng.",'place','".$n->name."');
\n";
}
}
?>
Therefore I am in doubt about these source code.
thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---