如何将经纬度转换为XY坐标系(例如UTM),然后将其映射到我的图像的像素空间 [英] how to Convert Lat ,long to an XY coordinate system (e.g. UTM) and then map this to pixel space of my Image

查看:1720
本文介绍了如何将经纬度转换为XY坐标系(例如UTM),然后将其映射到我的图像的像素空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很小的区域地图,我从Openstreet地图(PNG)和它的OSM(.osm)文件中下载了该文件,其中包含Lat,long.

I have a very small area map , which I downloaded from Openstreet map(PNG) and also its OSM(.osm) file which contains its Lat ,long.

现在,我想将Lat long转换为XY坐标系(例如UTM),然后将其映射到大小为(600 x 800)的我的Image像素空间.我知道它是一个双向过程,就像想知道如何做到这一点.谢谢

Now I want to convert Lat ,long to an XY coordinate system (e.g. UTM) and then map this to pixel space of my Image which is of size (600 x 800 ). I know its a two way process ,like to know how to do this . Thank you

推荐答案

GPS坐标到像素

  • 假设此地图未跨越本初子午线
  • 假设像素0,0位于左上方,像素600,800位于右下方.
  • 假设地图仅是北半球(地图的任何部分都不是南半球)

    GPS Coordinates to Pixels

    • Assuming this map does not cross prime meridian
    • Assuming pixel 0,0 is upper left, and pixel 600,800 is lower right.
    • Assuming map is Northern Hemisphere Only (no part of map is southern hemisphere)

      1. 确定800x600图像(X)中最左边的经度
      2. 确定800x600图像(Y)中最东的经度
      3. 确定经度差(Z = Y-X)
      4. 确定800x600图像(A)中的最北纬度
      5. 确定800x600图像(B)中最南端的纬度
      6. 确定经度差(C = A-B)

    • 给出纬度和经度,以确定他们单击了哪个像素:

      Given a Latitude and Longitude, to determine which pixel they clicked on:

      1. J =输入经度
      2. k =输入纬度

      1. J = Input Longitude
      2. K = Input Latitude

      计算X像素

      XPixel = CInt((((Y-J)/CDbl(Z))* 800)

      XPixel = CInt(((Y - J) / CDbl(Z)) * 800)

      计算Y像素

      YPixel = CInt((((A-K)/CDbl(C))* 600)

      YPixel = CInt(((A - K) / CDbl(C)) * 600)

      UTM

      这是一个制图图书馆,该数据库应有助于GPS到UTM的转换

      UTM

      Here is a cartographic library that should help with GPS to UTM conversions

      这篇关于如何将经纬度转换为XY坐标系(例如UTM),然后将其映射到我的图像的像素空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆