0

画像からの投影と緯度/経度座標の取得に関する固有の問題があります。

私は米国の 800 x 600 ピクセルの画像を持っており、画像の投影 (原点の中心が -75 lon の Polar Sterographic)、左下の緯度/経度、右上の緯度/経度を知っています。画像を Web ページに配置し、画像の上にマウスを置いて、div タグ内の画像から x および y の「ピクセル」座標を取得できます。x/y ピクセル座標の緯度と経度を取得するのに役立つ簡単な式はありますか?

複数の地図投影法と画像サイズがあるため、合理化されたプロセスが必要です。

4

1 に答える 1

0

これを行う方法についてコメントされたjsコードは次のとおりです。

//these define lat/lon at the bounds of the image
var geo_left=-75;
var geo_right=75;
var geo_top=-75;
var geo_bottom=75;

//dimensions of the canvas
//i set it to 400x400 for example purposes
var canvas_width=400;
var canvas_height=400;

//get relative coordinate of pixel, should be on a scale of 0 to 1
var rel_x = pixel_x/canvas_width;
var rel_y = pixel_y/canvas_height;

//linear interpolate to find latitude and longitude
var latitude = geo_left+(geo_right-geo_left)*rel_x;
var longitude = geo_top+(geo_bottom-geo_top)*rel_y;
于 2013-03-08T05:53:22.437 に答える