计算X和Y位置上的PNG地图的GPS坐标坐标、位置、地图、PNG

2023-09-11 05:05:13 作者:别摸我的婴儿肥

我实现自定义地图(图像尺寸地图宽度和地图高度)的iPhone应用程序,我试图表明在此显示当前用户的位置(current_long和current_lat)

I'm implementing a custom maps (image with size map_width and map_height) on an iPhone app and i try to show the current user position on this map (current_long and current_lat)

我有2个基准点,与已知的GPS坐标(ref1_long,ref1_lat,ref2_long和ref2_lat)和已知的X,以像素为单位Y位置(ref1_x,ref1_y,ref2_x和​​ref2_y)

I have 2 references points with a known GPS coordinates (ref1_long, ref1_lat, ref2_long and ref2_lat) and known X, Y positions in pixels (ref1_x, ref1_y, ref2_x and ref2_y)

我的问题是:如何根据这些信息计算current_x和current_y

My question is: how to calculate the current_x and current_y according to these informations ?

推荐答案

最有可能的映射使用mercantor投影。问题是,地球是一个球体,但你只有2地图上的尺寸。您需要的坐标的4个角的地图和地图的尺寸​​。的y地图值不会改变,但对于X映射值你所需要的mercantor投影。然后,它成为一个线性变换和宽度或地图的高度可以是从输入稍有不同:转换纬度/经度为像素坐标?。

Most likely the map uses a mercantor projection. The problem is that the earth is a sphere but you have only 2 dimensions on a map. You need the co-ordinate of the 4 corners of the map and the map dimensions. The y-map value doesn't change but for the x-map value you need the mercantor projection. Then it become a linear transformation and either the width or the height of the map can be slightly different from the input:Convert lat/lon to pixel coordinate?.