これは、緯度/経度座標が 10 進値であり、マップの可視範囲内で北/南または東/西から方向を変えないことを前提としています。その場合、そのような値は単一の形式に維持し、負にする必要があります (例: 1.0 S は -1.0 N になります)。
最初に、次の変数を設定します。PHP でそれらを見つけるか、スクリプトで既にわかっている場合は、次の変数を設定します。
$width=//width of image
$height=//height of image
$long_at_left=//Longitude of left-hand coordinates
$long_at_right=//Longitude of right-hand coordinates
$lat_at_left=//Latitude of left-hand coordinates
$lat_at_right=//Latitude of right-hand coordinates
$target_long=//Longitude you want to find
$target_lat=//Latitude you want to find
次に使用します。
$xtarget=$target_long-$long_at_left;
$ytarget=$target_lat-$lat_at_top;
$xdist=$long_at_left-$long_at_right;
$ydist=$lat_at_top-$lat_at_bottom;
$x=round(($xtarget/$xdist)*$width); //Percentage of distance times width
$y=round(($ytarget/$ydist)*$height); //Percentage of distance times height
または、その形式の何かがうまくいくはずです。