如何计算谷歌静态地图中的每像素距离 [英] How to calculate distance per pixel in google static maps

查看:209
本文介绍了如何计算谷歌静态地图中的每像素距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我的应用程序使用中心点位置Lat,Lon,图像大小600 * 600并指定缩放来获取Google静态地图中的地图图像

现在在地图上工作我需要知道它中每个像素的距离

i认为它应该通过缩放,图像大小和中心位置来计算,但我不知道如何做到这一点



我的应用程序是windows窗体

Hi All
My application is getting a maps images from "Google static maps" using a center point location"Lat,Lon" , image size 600*600 and specified zoom
Now to work on maps i need to know the distance per pixel in it
i think it should be calculate by zoom, image size and center location but i don't know the way to do that

My application is windows form

推荐答案

我用中心点计算它

I calculate it by using the center point
double earthC = 6371000 * 2 * Math.PI;
double factor = Math.Pow(2, 8 + m_intZoomLevel);
double MeterPerPixel = (Math.Cos(CenterLat * Math.PI / 180) * earthC / factor)/2;
double MapWidthDistance = OrginalImageWidth * MeterPerPixel;
double ActualMeterPerPixel = MapWidthDistance / imgWidthAfterResize;


这篇关于如何计算谷歌静态地图中的每像素距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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