Re: 2 markers at same point & combine info window data
For your situation, if you're only looking for the exact same points
(not all points within a small range that might be displayed over each
other but just the exact same points) it would be easiest to make sure
you order them by the coordinates in the request and to keep track of
the previous point and combine their html.
Means your mysql should look something like:
Select html,lat,long from walking_pts ORDER BY lat,long
You can either rewrite your javascript marker functions to reference
the last marker and check against it or handle it in the php-side.
<?php #example point fetching
$qry = mysql_query("Select html,lat,long from walking_pts ORDER BY
lat,long");
if (mysql_num_rows($qry)>0)
{ $oldLat = null,$oldLong=null,$oldHtml=null;
while (list($rhtml,$rlat,$rlong)=mysql_fetch_row($qry))
{ if ($rlat!=$oldLat || $long!=$oldLong)
{ if (!(is_null($oldLat)||is_null($oldLong))
echo "map.addOverlay(currentMarker(new
GPoint($oldLat,$oldLong),$oldHtml));\n";
$oldLat=$rlat;
$oldLong=$rlong;
$oldHtml=$rhtml;
} else
$oldHtml.=($seperator).$rhtml;
}
echo "map.addOverlay(currentMarker(new
GPoint($oldLat,$oldLong),$oldHtml));\n";
}
?>
It becomes a much more difficult problem when you want to coalesce
coordinates that aren't exactly the same, but that is discussed
elsewhere on these boards.
0 Comments:
Yorum Gönder
<< Home