安卓:充分利用谷歌地图无效KML文件 [英] Android: Getting an invalid KML file from google maps

查看:359
本文介绍了安卓:充分利用谷歌地图无效KML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获得并使用来自m​​aps.google.com显示实时.KML文件

<$p$p><$c$c>Uri.parse(\"geo:0,0?q=http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=104538451667315338387.0004887d133ba2ab6eec9&ll=42.029611,-93.646109&spn=0.011396,0.022724&z=16l&output=kml\");意图mapIntent =新意图(Intent.ACTION_VIEW,马普里);startActivity(Intent.createChooser(mapIntent,笑));

然而开放的MapView我得到通知说无法显示该社区地图,因为它包含错误之后

我只有在我直接从maps.google下载.KML得到这个错误。如果我复制完全相同的链接到我的地址栏,下载.KML文件,并上传到其他地方,然后它工作正常。我想是能够直接从谷歌获得的地图,这样我可以做出改变,它会立即反映给我的用户。


解决方案

我有同样的问题 - 如果你用&放大器;为参数分隔符,谷歌地图Android版切断URL,所以用%26,而不是:

 意图navigateToIntent =新意图(Intent.ACTION_VIEW,Uri.parse(
    地理:0,0 Q = HTTP:?//m.konzoomer.com/kml ID =+ ID +
    %26latitudeE12 =+ latitudeE12 +%26longitudeE12 =+ longitudeE12 +
    %26radiusMeters =+ radiusMeters));

I'm trying to get and display a live .kml file from maps.google.com using

Uri.parse("geo:0,0?q=http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=104538451667315338387.0004887d133ba2ab6eec9&ll=42.029611,-93.646109&spn=0.011396,0.022724&z=16l&output=kml");

Intent mapIntent = new Intent(Intent.ACTION_VIEW, mapUri);

startActivity(Intent.createChooser(mapIntent, "lol"));

However after opening the mapview I get a notification saying "The community map could not be displayed because it contains errors"

I only get this error if I download the .kml directly from maps.google. If I copy the exact same link into my address bar, download the .kml file, and upload it elsewhere then it works fine. I would like to be able to get the maps directly from Google that way I can make a change and it would be immediately reflected to my users.

解决方案

I had the same problem - if you use "&" as parameter separator, Google Maps for Android cuts off the URL, so use "%26" instead:

Intent navigateToIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
    "geo:0,0?q=http://m.konzoomer.com/kml?id=" + id +
    "%26latitudeE12=" + latitudeE12 + "%26longitudeE12=" + longitudeE12 +
    "%26radiusMeters=" + radiusMeters));

这篇关于安卓:充分利用谷歌地图无效KML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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