经纬度坐标转换成px_如何将经纬度转换为XY坐标系(例如UTM),然后将其映射到我的图像的像素空间...

本文介绍如何将小区域地图的经纬度坐标转换为UTM坐标,并进一步映射到600x800像素的图像空间。内容包括了从GPS坐标到像素的转换方法以及使用库进行UTM转换的提示。
摘要由CSDN通过智能技术生成

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.

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 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)

Determine the left-most longitude in your 800x600 image (X)

Determine the east-most longitude in your 800x600 image (Y)

Determine Longitude-Diff (Z = Y - X)

Determine north-most latitude in your 800x600 image (A)

Determine south-most latitude in your 800x600 image (B)

Determine Longitude-Diff (C = A - B)

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

J = Input Longitude

K = Input Latitude

Calculate X-pixel

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

Calculate Y-pixel

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

UTM

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值