【问题标题】:Image Pixel X,Y coordinates to Lat/Lon图像像素 X,Y 坐标到纬度/经度
【发布时间】:2013-02-23 12:31:42
【问题描述】:

我有一个独特的问题:投影和从图像中获取纬度/经度坐标。

我有一张 800 x 600 像素的美国图像,并且我知道图像的投影(原点中心为 -75 lon 的极地立体投影)、左下纬度/经度和右上纬度/经度。我已将图像放入网页中,并且可以将鼠标悬停在图像上并从 div 标签中的图像中获取 x 和 y“像素”坐标。有没有简单的公式可以帮助获取 x/y 像素坐标的 lat 和 lon?

我想要一个简化的流程,因为我有多种地图投影和图像尺寸。

【问题讨论】:

  • 我不确定我是否理解问题所在。您有将纬度/经度与 x/y 相关联的投影。题主不知道这个公式吗?
  • 我想通过div标签的x,y坐标来计算其下方底图上的实际经纬度。

标签: php javascript image maps latitude-longitude


【解决方案1】:

下面是注释的 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;

【讨论】:

  • 除非此算法是极地立体投影的实现,否则我认为不会起作用。
  • 我有四个纬度/经度角,有没有办法将图像的 x,y 像素转换为纬度/经度?
猜你喜欢
  • 2013-09-04
  • 2016-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多