//PHPの設定 ini_set("output_buffering",1); ini_set("output_handler","mb_output_handler"); ini_set("mbstring.http_input","sjis"); ini_set("mbstring.http_output","sjis"); ini_set("mbstring.internal_encoding","sjis"); //GOOGLE API KEY define("GOOGLE_MAP_API_KEY","ABQIAAAA2kAO3WQCS6Ln-isUJSg-TRSHuy3caWQsgPOO9HzzRn2Ro8VLhRTj_0Q6dtr-c5iHTmFlbhcC1Jz4mw"); //マークを打つ位置 $lat = htmlspecialchars($_GET["lat"]); $lng = htmlspecialchars($_GET["lng"]); if($lat == ""){ $lat = "34.819533"; } if($lng == ""){ $lng = "137.732836"; } //地図の中心 $c_lat = htmlspecialchars($_GET["c_lat"]); $c_lng = htmlspecialchars($_GET["c_lng"]); if($c_lat == ""){ $c_lat = $lat; } if($c_lng == ""){ $c_lng = $lng; } //縮尺率 $z = htmlspecialchars($_GET["z"]); if($z ==""){ $z = 15; } //移動後の位置を計算 $top = adjust($c_lng,$c_lat,0,-100,$z); $bottom = adjust($c_lng,$c_lat,0,100,$z); $left = adjust($c_lng,$c_lat,-100,0,$z); $right = adjust($c_lng,$c_lat,100,0,$z); /* function adjust $x:中心の経度 $y:中心の緯度 $deltaX:ずらしたい距離(ピクセル単位) $deltaY:ずらしたい距離(ピクセル単位) $z:ズーム 戻り値 array("x"=>"移動後の経度","y"=>"移動後の緯度"); */ function adjust($x,$y,$deltaX,$deltaY,$z){ $offset=268435456; $radius=$offset / pi(); $xy = array( "x"=>((round(round($offset + $radius * $x * pi()/180)+($deltaX << (21-$z))) - $offset) / $radius) * 180 / pi(), "y"=>(pi() / 2 - 2 * atan(exp((round(round($offset - $radius * log((1 + sin($y * pi() / 180))/(1 - sin($y * pi() / 180))) / 2)+($deltaY << (21-$z))) - $offset) / $radius))) * 180 / pi() ); return $xy; } ?>