Google maps 黑莓:将KML文件传递给谷歌地图

Google maps 黑莓:将KML文件传递给谷歌地图,google-maps,blackberry,kml,Google Maps,Blackberry,Kml,我想知道我可以把KML作为字符串传递给google地图应用程序吗 代码段: //KML String String document = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><Folder><name>Paths</name><open>0</o

我想知道我可以把KML作为字符串传递给google地图应用程序吗

代码段:

//KML String
 String document = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><Folder><name>Paths</name><open>0</open><Placemark><LineString><tessellate>1</tessellate><coordinates> -112.0814237830345,36.10677870477137,0 -112.0870267752693,36.0905099328766,0</coordinates></LineString></Placemark></Folder></Document></kml>";

//Invoke Google Maps

int module = CodeModuleManager.getModuleHandle("GoogleMaps");

if (module == 0) {
  try {
    throw new ApplicationManagerException("GoogleMaps isn't installed");
  } catch (ApplicationManagerException e) {
    System.out.println(e.getMessage());
  } 
}

String[] args = {document}; //Is this possible???
ApplicationDescriptor descriptor = CodeModuleManager.getApplicationDescriptors(module)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(descriptor, args);
try {
     ApplicationManager.getApplicationManager().runApplication(ad2, true);
    } catch (ApplicationManagerException e) {
      System.out.println(e.getMessage());
 }
//KML字符串
String document=“Paths01-112.0814237830345,36.10677870477137,0-112.0870267752693,36.0905099328766,0”;
//调用谷歌地图
int module=CodeModuleManager.getModuleHandle(“谷歌地图”);
如果(模块==0){
试一试{
抛出新的ApplicationManagerException(“未安装谷歌地图”);
}捕获(ApplicationManagerException e){
System.out.println(e.getMessage());
} 
}
字符串[]args={document}//这可能吗???
ApplicationDescriptor描述符=CodeModuleManager.getApplicationDescriptors(模块)[0];
ApplicationDescriptor ad2=新的ApplicationDescriptor(描述符,args);
试一试{
ApplicationManager.getApplicationManager().runApplication(ad2,true);
}捕获(ApplicationManagerException e){
System.out.println(e.getMessage());
}

经过大量的研发……我发现答案是-不,我们不能将KML作为字符串传递。


Google Maps Mobile接受URL参数。这需要采用“http://”的形式,可以是特定参数(如“?…”)或KML文件(“”)。

如果使用GoogleMaps API,则必须解析地图文件(KML、gpx、txt)

如果您只想在googlemaps窗口中查看KML文件,可以转到标准,在地址框中输入KML文件的完整http地址

在2012年4月之前,该功能一直工作正常,侧边栏将正确填充可单击的项目(单击侧边栏条目[例如,“点1”将飞到等效位置)。截至2012年5月,该功能工作不正常

如果您想更进一步,可以让PHP页面响应kml(从数据库或文件动态呈现kml)。但是,googlemaps在10到15分钟内不会刷新动态生成的输出


如果您想要Google Maps API vs3的一些javascript GPX和TXT mapFile渲染,请PM me:2012年6月,fly-to再次工作,但线串跟踪无法正常工作(大多数情况下,覆盖层未完全绘制)。可能只是新版谷歌地图api中的一个障碍。这本身就是一个严重的问题。谷歌对向后兼容性不感兴趣:它不仅改变了api版本之间的整个命令系列,还改变了其逻辑和结构。我浪费了6个月的开发时间,因为我相信谷歌会提供稳定的e和一致的平台。我不会重复这个错误。OpenLayers是一个不错的选择。我怎样才能得到多个经度、纬度的kml文件,我想把它放在谷歌地图上??