KMLViewer Apple的示例不起作用 [英] KMLViewer Apple's example not working

查看:82
本文介绍了KMLViewer Apple的示例不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找我的问题的答案,但没有成功. 所以就这样...

I've been searching for quite sometime an answer to my problem with no success. So here it goes...

KMLViewer,Apple的示例在某些情况下不起作用. 在执行README步骤之后,我尝试在葡萄牙里斯本和葡萄牙波尔图之间建立一条路线.在这里,最奇怪的事情发生了.注释构建正确,尽管叠加层(MKPolyline)不能正确构建,但它仅绘制路线的一部分,并在注释"的中间开始绘制.

KMLViewer, Apple's example is not working in some cases. After executing the README steps, i've tried to build up a route between Lisboa, Portugal and Porto, Portugal. And here the strangest thing happens. The annotations are built correctly, although the overlay (MKPolyline) does not, it only draws part of the route and it starts drawing in the middle of an "annotation".

我想念什么? 您可以尝试,马德里-巴塞罗那,您也遇到同样的问题.

What am i missing ? You can try, Madrid - Barcelona, you have also the same issue.

预先感谢您花一些时间在此问题上.

Thanks in advance for spending sometime in this issue.

推荐答案

似乎KMLViewer每个Placemark只能处理一个LineString对象.

It looks like KMLViewer can only handle one LineString object per Placemark.

对于您尝试的路线,Google在路线"地标(文件中的最后一个)中返回了两个LineString对象. KMLViewer仅显示第二个(最后一个)LineString段.

For the route you tried, Google is returning two LineString objects in the "Route" Placemark (the last one in the file). KMLViewer only displays the second (last) LineString segment.

除了更新KMLViewer代码以为每个地标添加对多个LineString对象的支持(这似乎是一个很好的练习)之外,您还可以尝试以下两种解决方法:

Aside from updating the KMLViewer code to add support for multiple LineString objects per Placemark (which looks like a good exercise), you can try these two workarounds:

将两个LineString对象中的坐标合并为一个LineString.更改:

Combine the coordinates from the two LineString objects into one LineString. Change:

<Placemark>
    <name>Route</name>
    <description>some cdata stuff here</description>
    <GeometryCollection>
        <LineString><coordinates>coord1 … coordN</coordinates></LineString>
        <LineString><coordinates>coordN+1 … coordK</coordinates></LineString>
    </GeometryCollection>
    <styleUrl>#roadStyle</styleUrl>
</Placemark>

对此:

<Placemark>
    <name>Route</name>
    <description>some cdata stuff here</description>
    <GeometryCollection>
        <LineString><coordinates>coord1 … coordN coordN+1 … coordK</coordinates></LineString>
    </GeometryCollection>
    <styleUrl>#roadStyle</styleUrl>
</Placemark>

以上内容仅对应该是连续的路线(线段)有意义.

The above might only make sense for routes (line segments) that are supposed to be continuous.

另一种解决方法是将"Route"地标拆分为多个地标(每个LineString一个):

Another workaround is to split the "Route" Placemark into multiple placemarks (one for each LineString):

<Placemark>
    <name>Route A</name>
    <description>some cdata stuff here</description>
    <GeometryCollection>
        <LineString><coordinates>coord1 … coordN</coordinates></LineString>
    </GeometryCollection>
    <styleUrl>#roadStyle</styleUrl>
</Placemark>
<Placemark>
    <name>Route B</name>
    <description>some cdata stuff here</description>
    <GeometryCollection>
        <LineString><coordinates>coordN+1 … coordK</coordinates></LineString>
    </GeometryCollection>
    <styleUrl>#roadStyle</styleUrl>
</Placemark>

与此相关的一个问题是,包含距离和时间信息的说明"将与拆分路线不匹配.

One issue with this is that the "description" which contains distance and time info will not match the split routes.

这篇关于KMLViewer Apple的示例不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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