usage: map.php?id=ID&q=QUERY
ID: IMDb id
QUERY: search term');
$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 <<