脱机静态图片(JPEG)上显示用户当前位置 - Android电子 [英] Show current location of user on an offline static image (jpeg) - Android

查看:136
本文介绍了脱机静态图片(JPEG)上显示用户当前位置 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景/概念:我想创建一个应用程序,可以帮助用户搜索特定的东西。我们说,附近的餐馆。在这里,我想包括离线地图覆盖周围的餐厅1公里的地区,(谷歌地图的它很容易,我可以拿卡)。

Background / Concept: I want to create an application that can help user searching for specific things. Let say nearby restaurants. Here I want to include an offline map covering 1 km area around that restaurant, (its easy i can take snap of google map).

问题:是有可能表明在静态图像文件的当前用户的位置?我有一些想法,我注意到,图像的所有四个角落的纬度/长,取用户的当前位置,做一些计算和显示当前点。但我不能确定从哪里开始,如果已经有一个很好的优化解。

Problem: is it possible to indicate current user position on that static image file? I have some idea that I note the Lat / Long of all four corners of that image, take user current position, do some calculation and show the current spot.. But I m not sure where to start and if there is already a good optimized solution.

如果我可以显示当前用户的方向(航向)这将是真棒!

If I can show current user direction (heading) it will be awesome!

更简洁的问题:
我有一个JPEG图像(这实际上是一个街道地图),我知道拉/长图像的所有四个角落。我怎样才能显示图像上当前用户的位置?

MORE CONCISE QUESTION: I have a jpeg image (which is actually a street map) and I know lat / long of all four corners of image. How can i show current user location on that image?

P.S。该应用程序是假设没有数据连接的工作,所以我不能加载谷歌地图等

推荐答案

比方说,用户位置和乌拉特uLon,并在地图上会有左上角tlLat和tlLon和右下角brLat和brLon。最后,地图大小为x和y像素。

Lets say that user position is uLat and uLon, and the map have top left corner tlLat and tlLon, and bottom right corner brLat and brLon. Finally, map size is x and y pixels.

userX = x*(uLon-tlLon)/(brLon-tlLon);
userY = y-y*(uLat-brLat)/(tlLat-brLat);

这是仅适用于短距离(一公里应该是罚款),因为它没有考虑到地球曲率的aproximation。

This is an aproximation that only works for small distances (1 km should be fine) as it's not taking into consideration the earth curvature.

我不知道这是合法使用的谷歌地图截图未经授权。

I'm not sure that's legal to use google map screenshot without authorization.

好运。

这篇关于脱机静态图片(JPEG)上显示用户当前位置 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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