usage: map.php?id=ID&q=QUERY
ID: IMDb id
QUERY: search term'); $id = str_pad($id, 7, '0', STR_PAD_LEFT); $size = $_GET['size']; if ($size != 'small') $size = 'large'; $q = urldecode($_GET['q']); $q = htmlentities($q); $point = movie2locations($id); if ($point) { $point_ = $point; foreach ($point as $key => $value) { foreach ($point_ as $key_ => $value_) { if ($key != $key_ && $value_['location'] == substr($value['location'], -1 * strlen($value_['location']))) { // echo $value_['location'] . '
'; unset($point_[$key_]); break; } } } unset($point); $key = 0; foreach ($point_ as $key_ => $value_) { $point[$key] = $value_; $key++; } foreach ($point as $key => $value) { if (!$flag || $value['coordinates']['latitude'] - $value['coordinates']['spanLatitude'] / 2 < $minLatitude) $minLatitude = $value['coordinates']['latitude'] - $value['coordinates']['spanLatitude'] / 2; if (!$flag || $value['coordinates']['latitude'] + $value['coordinates']['spanLatitude'] / 2 > $maxLatitude) $maxLatitude = $value['coordinates']['latitude'] + $value['coordinates']['spanLatitude'] / 2; if (!$flag || $value['coordinates']['longitude'] - $value['coordinates']['spanLongitude'] / 2 < $minLongitude) $minLongitude = $value['coordinates']['longitude'] - $value['coordinates']['spanLongitude'] / 2; if (!$flag || $value['coordinates']['longitude'] + $value['coordinates']['spanLongitude'] / 2 > $maxLongitude) $maxLongitude = $value['coordinates']['longitude'] + $value['coordinates']['spanLongitude'] / 2; $flag = true; } // var_dump($point); exit; $centerLatitude = ($minLatitude + $maxLatitude) / 2; $centerLongitude = ($minLongitude + $maxLongitude) / 2; $spanLatitude = $maxLatitude - $minLatitude; $spanLongitude = $maxLongitude - $minLongitude; echo << Google Map ($id) HTML; if ($size == 'small') echo '
'; else echo '
'; echo << HTML; } else { echo << Google Map ($id) HTML; if ($size == 'small') echo "
"; else echo "
"; echo << HTML; } ?>