ios自定义地图,地理位置,地图等等 [英] ios custom maps, geolocation, mapping and more

查看:81
本文介绍了ios自定义地图,地理位置,地图等等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下一张图片来自www.Trimaps.com



(我希望这里允许使用图片,如果没有,请告诉我,立即将其删除)。



这些图片完全解释了我想要完成的事情。



所有需要的数据:


  1. 所需区域的4个角的纬度/经度(十进制值)地图)。


  2. 美丽的自定义山峰图像(类似于正确的图像)。

  3. ol>

    我需要的是数学。我已经尝试过所有的公式,缩放/转换,您可以命名它。



    我相信这是可能的,因为它依赖于纯数学,相对简单的数学方程。 / p>

    www.Trimaps.com目前希望使用他们的代码300美元。
    对于所有的尊敬,对我来说有点贵...



    有人知道开源还是自己做到了这一点?



    更新:顺便说一句,我不是要求代码复制&糊。我知道如何编码。



    我询问过程,逻辑背后的公式。



    任何帮助都会非常感谢:)



    谢谢大家!

    解决方案

    关于您可能负担的复杂性。
    例如,将大的地图图片分割为小图块并按需加载它们会更好。

    无论如何,您都可以使用UIScrollView。我将简短地介绍一个巨大的图像解决方案(不确定是否可以使用像这样的大图像)。你需要选择度/公里比的计算公式,你可能在维基百科找到很多:纬度 a>或搜索 km度纬度或者像这样。
    当您知道一度纬度和一度经度有多少公里时,您可以使用此信息以及scrollView的缩放级别。因此,现在您需要根据scrollView的缩放级别来获取一个点内的公里数。您可以轻松获得比例,就您所知的地理矩形坐标,scrollView的框架和scrollView的内容状态而言。



    有了这些信息,您可以将位置坐标转换为视点和反之亦然。所以你甚至可以放置一个位置别针或其他东西。



    另请检查: http://mapbox.com/mobile/ 和此答案



    更新:
    首先,男士,看到我的答案不被接受真的很不愉快,但无论如何,我会添加一些信息。下次我不打扰。
    检查UIScrollView的 contentOffset和contentSize 属性。这意味着您可以使用 contentSize contentView的框架的组合来管理缩放级别。我的意思是你可以调整大小,例如UIImageView,并使用UIScrollView的contentOffset定位它的可见框架。


    The next image was taken from www.Trimaps.com

    (I hope it's allowed to use images here, if not, please tell me and i'll remove it immediately).

    These images explain perfectly what i'm trying to accomplish.

    I have all the data one would need:

    1. Latitude/Longitude (in decimal values) of 4 corners of the desired area (from Google Maps).

    2. A beautiful custom image of a mountain (similar to the right image).

    All i need is the math. I've tried all the formula's, scaling/ transfomations, you name it.

    I'm sure it's possible as it depends on pure MATH, relatively simple math equations.

    www.Trimaps.com currently wants 300$ from using their code. With all deu respect, it's a little expensive for me...

    Does anyone knows about open source or have achieved this by himself?

    UPDATE: BTW, I'm not asking for code to copy & paste. I know how to code.

    I'm asking about the procedure, the logic behind, formulas.

    Any kind of help will be much appreciated :)

    Thanks everybody!

    解决方案

    That also depends on complexity you may afford. For example that would be better to split big map image to small tiles and load them on demand.

    You could use UIScrollView anyway, using tiles or not. I'll be short with a single huge-image solution (not sure if it will be ok to use big image like this). You need to choose degree-for-km ratio calculation equation, you may find a lot in wikipedia: Latitude or search km per degree latitude or like this. When you know how many km is in one degree latitude and one degree longitude you may use this information along with zoom level of scrollView. So now you need to get how many km is in one point according to the zoom level of scrollView. You may get the ratio easily as far as you know geographical rectangle coordinates, scrollView's frame and scrollView's content state.

    With all that info you may transform location coordinates to view points and vice versa. So you may even put a location pin or something.

    Also check this: http://mapbox.com/mobile/ and this answer.

    UPDATE: At first, man, that's really unpleasant to see my answer to be unaccepted, but anyway, I'll add some info. Next time I'm not going to bother. Check UIScrollView's contentOffset and contentSize properties. That means you can manage zoom level by yourself using some combination of contentSize and contentView's frame. I mean you may resize for example an UIImageView and position it's visible frame with UIScrollView's contentOffset.

    这篇关于ios自定义地图,地理位置,地图等等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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