在屏幕上绘制 n 个 GPS 坐标,而不是*不*任何地图
假设我在位置 M(纬度,经度),并且我还有 3 个 GPS 坐标 A(纬度,经度),B(纬度,经度)和 C(纬度,经度),它们都在 M 周围 500 米半径范围内
注意:我想在屏幕上将它们相对于彼此绘制,但不与任何其他地图或其他任何东西以及 GPS 数量M 周围的点可能会增加或减少但始终位于 M 周围 500 米半径内。M
将位于屏幕中心。 ScreeWidth=320,ScreenHeight=400
我有以下信息
M = 31.484083, 74.392708,
A = 31.483552, 74.392386 and distance from M is 66.42 Meters approximately
B = 31.483534, 74.392532 and distance from M is 63.23 Meters approximately
C = 31.483421, 74.392434 and distance from M is 78.00 Meters approximately
M 将在屏幕的 WIDTH/2 和 HEIGHT/2 处绘制
A、B 和 C 需要一个转换函数,该函数将返回 x 和 y(以像素为单位),并尊重 M 和
屏幕宽度和高度,请记住这些点始终位于 M 周围 500 米半径内。
这样我就可以绘制这些点,如下图所示。
这是图像:
https://picasaweb.google.com/lh/photo/J7PE6RuSqu7Pv9xv9D2PgQ?feat= directlink
我只需要 x 和 y 的转换函数,我知道怎么做将它们绘制在屏幕上
Suppose I am on location M(latitude, longitude), and I have 3 More GPS coordinates A(lat, lon) ,B (lat, lon), and C(lat, lon) which are in range of 500 meters radius around M.
NOTE: I want to plot them on screen with respect to each other but NOT to any other map or anything else, and number of gps point around M may increase or decrease but will always be in radius 500 meters around M.
M will be at the center of screen. ScreeWidth=320, ScreenHeight=400
I have following information
M = 31.484083, 74.392708,
A = 31.483552, 74.392386 and distance from M is 66.42 Meters approximately
B = 31.483534, 74.392532 and distance from M is 63.23 Meters approximately
C = 31.483421, 74.392434 and distance from M is 78.00 Meters approximately
M will be drawn at WIDTH/2 and HEIGHT/2 of the screen
for A, B and C a CONVERSION FUNCTION is required that will return x and y in pixels with RESPECT to M and
screen width and height, keeping in mind these points will always be within 500 meter radius around M.
So that I can plot these points as shown in picture below.
Here is image :
https://picasaweb.google.com/lh/photo/J7PE6RuSqu7Pv9xv9D2PgQ?feat=directlink
I only need a conversion function for x and y, I know how to draw them on screen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,您需要实现一种将纬度/经度映射到像素,并将像素映射到纬度经度的方法...或者确定距参考点 M 的距离/方位角的方法,然后将该距离/方位角映射到像素值。
如果您希望通过纬度/经度进行引用,请使用每像素纬度的一定度数和每像素经度的一定度数的线性像素图。我建议您访问 google 地球,检查您感兴趣的区域 500 米的纬度和经度差异。世界上所有点的纬度设置为每度 60 海里,我很确定经度大约是每度 60*cos(lat) 海里(近似值,谷歌搜索一下)。
如果您希望通过距离进行参考,我建议使用球形地球近似,并使用半正弦建立一种方法来确定跨越大球体的距离。如果您使用 matlab,找到此类示例的最佳位置是文件交换中的 google 或 mathworks.com。
当你有办法将经纬度或距离/纬度映射到像素值后......剩下的就是绘图了。
祝你好运
下面是名为 vreckon 和 geodistance 的代码,如果你想在 java 中实现,你可以自己解析它 - 我自己已经做了 vreckon 所以我会给你工作 vreckon java,如果你想做 geodistance (检查之间的距离两个经纬度点)你需要自己做。
VRECKON 的 JAVA 代码 ::::::
hvDistance 是距您的经纬度点的水平距离,latitudeOrigin 和 longitudeOrigin 是您的纬度/经度位置,方位角是距您的原点的方向。
输出将是新的纬度和经度点。如果您想在 java 中实现,您应该能够通过 matlab 代码并对下面的地理距离执行相同的操作。这正是使您达到 WGS84 标准精度的东西。享受
用于地理距离的 MATLAB 代码 :::::
Well, you need to implement a method that maps lat/lon to pixels, and pixels to lat lon...or a method that determines distance/azimuth from your reference point M, and then maps that distance/azomith to a pixel value.
If you wish to reference by lat/lon -- use a linear pixel map of some set number of degrees per pixel latitude and degrees per pixel longitude. I recommend going to google earth and checking what the different in latitude and longitude are at your area of interest are for 500 meters. latitude is set at 60 nautical miles per degree across all points in the world, and I am pretty sure longitude is something like 60*cos(lat) nautical miles per degree (approximation, google this).
If you wish to reference by distance, I recommend using a spherical earth approximation and building a method using haversines to determine distance across the great sphere. The best place to find examples of this is google or mathworks.com in the file exchange if you speak matlab.
After you have a way to map lat lon or dist/az to pix values..the rest is just drawing.
Good luck
Below is code called vreckon and geodistance, you can parse through it yourself if you want to implement in java -- i already did vreckon myself so I will give you the working vreckon java, if you want to do geodistance (check distance between two lat lon points) you will need to do yourself.
JAVA CODE FOR VRECKON ::::::
hvDistance is the horizontal distance from your lat lon point, latitudeOrigin and longitudeOrigin is your lat/lon position, and azimuth is direction from your origin.
The output will be the new latitude and longitude point. You should be able to go through matlab code and do the same with geodistance which is below if you want to implement in java. This is the exact stuff which will get you to the WGS84 standard accuracy. enjoy
MATLAB CODE FOR GEODISTANCE :::::
好吧,最后我设法编写了一个转换函数,它对我有用并且工作正常,因为我在不同位置进行了测试,并且参考中心点(M),所有其他点都以完美的比例显示。
OK finally I managed to write a conversion function which do the trick for me and works fine as I have tested on different location and with reference to centre point(M) all other points are displayed with perfect proportion.