简体   繁体   English

pdf / UIImage文件的当前位置

[英]Current location on a pdf/UIImage file

I am trying to make a pdf or UIImage as a map. 我试图将pdf或UIImage作为地图制作。 Is there any way i can integrate Latitude and Longitude in a pdf so that i can show the current location on that pdf file? 有什么方法可以在PDF格式中集成纬度和经度,以便我可以在该pdf文件上显示当前位置吗?

I know how to show current location in google map. 我知道如何在谷歌地图中显示当前位置。 But i have totally no idea how to replace it with a pdf or UIImage. 但我完全不知道如何用pdf或UIImage替换它。

Many Thanks 非常感谢

You'll need to know the bounds of your image, and how it correlates to GPS. 您需要知道图像的边界,以及它与GPS的关系。 For example, if your image shows the range from latitude 33 degrees to 34 degrees, and longitude -112 to -113 degrees, then you can just map within this range. 例如,如果您的图像显示的范围从纬度33度到34度,经度为-112到-113度,那么您可以在此范围内进行映射。 You also need to know how big your image is- let's assume 1000x1000. 你还需要知道你的图像有多大 - 让我们假设1000x1000。

So, if you have a coordinate at, let's say, 33.25 by -112.25, then your pixel position within the image would be 250,750. 所以,如果你有一个坐标,比方说33.25乘-112.25,那么你在图像中的像素位置将是250,750。

The actual transform for a map is 地图的实际变换是

destX = (destMaxX - destMinX) * (sourceX / (sourceMaxX - sourceMinX));

In our example, 在我们的例子中,

destMaxX = 1000;
destMinX = 0;
sourceX = 33.25;
sourceMaxX = 34;
sourceMinX = 33;

Same goes for Y, you just plug in Y everywhere you see X. 同样适用于Y,你只需在看到X的地方插入Y.

Hopefully this gets you on the right track. 希望这能让你走上正轨。

蒂姆说你如何居中并像地图一样识别图像,但记得设置ShowUserLocation=YES

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM