--- a/include/common-geo.inc.php +++ b/include/common-geo.inc.php @@ -1,60 +1,68 @@ $mapPoint) { if ($twotone && $index == 0) { - $markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . "iconr" . ($index + 1); - $center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; + $markers = 'markerd=color:red|' . $mapPoint[0] . ',' . $mapPoint[1] . '&markers='; } else { - $markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1); - } - if ($index + 1 != sizeof($mapPoints)) - $markers.= "|"; - $dist = distance($mapPoints[0][0], $mapPoint[0][1], $mapPoint[0], $mapPoint[1]); - $mapwidthinmeters = ($dist > $mapwidthinmeters ? $dist : $mapwidthinmeters); - $totalLat+= $mapPoint[0]; - $totalLon+= $mapPoint[1]; - } - if ($zoom == 0) { - $mapwidthinmeters = distance($minlat, $minlon, $minlat, $maxlon); - foreach (array_reverse($metersperpixel, true) as $zoomLevel => $maxdistance) { - if ($zoom == 0 && $mapwidthinmeters * 1.5 < ($maxdistance)) - $zoom = $zoomLevel; + if ($numbered) { + $label = ($index > 9 ? 9 : $index); + $markers.= 'markers=label:' . $label . '|' . $mapPoint[0] . ',' . $mapPoint[1]; + if ($index + 1 != sizeof($mapPoints)) { + $markers.= '&'; + } + } else { + $markers.= $mapPoint[0] . ',' . $mapPoint[1]; + if ($index + 1 != sizeof($mapPoints)) { + $markers.= '|'; + } + } + $index++; } } - $center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints); } - $output = ""; + $output = ''; if ($collapsible) $output.= '

Open Map...

'; - $output.= ''; + if (isIOSDevice()) + $output.= 'map of stop location'; + else + $output.= 'map of stop location'; + if ($collapsible) $output.= '
'; return $output; @@ -76,7 +84,7 @@ if ($km < 1) return floor($km * 1000); else - return round($km, 2) . "k"; + return round($km, 2) . 'k'; } else return floor($km * 1000); @@ -145,22 +153,20 @@ function geocode($query, $giveOptions) { global $cloudmadeAPIkey; - $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; + $url = 'http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=' . urlencode($query) . '&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true'; $contents = json_decode(getPage($url)); if ($giveOptions) return $contents->features; elseif (isset($contents->features[0]->centroid)) - return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1]; + return $contents->features[0]->centroid->coordinates[0] . ',' . $contents->features[0]->centroid->coordinates[1]; else - return ""; + return ''; } function reverseGeocode($lat, $lng) { global $cloudmadeAPIkey; - $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road"; + $url = 'http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=' . $lat . ',' . $lng . '&distance=closest&object_type=road'; $contents = json_decode(getPage($url)); return $contents->features[0]->properties->name; } -?> -