【问题标题】:no included points Exception of google maps in ionic没有包含点 离子中的谷歌地图例外
【发布时间】:2017-08-04 14:08:13
【问题描述】:

当我在地图中添加折线时,会出现以下错误。

private routeOptions: PolylineOptions = {
        'points': [],
        'geodesic': false,      
        'color': '#488aff',  
        'width': 10,
    };

console.log("this console log is shown");
this.map.addPolyline(routeOptions).then((polyline) => { 
     console.log("this console log isn't shown as the addPolyline gives an exception");
});

它给出了这个错误:

Exception java.lang.IllegalStateException: no included points
com.google.android.gms.common.internal.zzbo.zza ()
com.google.android.gms.maps.model.LatLngBounds$Builder.build ()
plugin.google.maps.PluginPolyline$1.run (PluginPolyline.java:79)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:7325)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

我怀疑问题与 routeOptions 对象中的 'points' 键有关。

感谢任何帮助。

附加信息: 我正在使用 Ionic 3.5,使用 cordova-plugin-googlemaps 插件(本机离子)

【问题讨论】:

    标签: cordova google-maps cordova-plugins ionic3


    【解决方案1】:

    检查Polyline API

    map.addPolyline() 方法采用单个折线选项对象字面量,指定折线的初始属性。

    points Array.LatLng LatLng 位置的数组。

    目前你正在传递一个空的点数组这意味着没有路径被传递

    异常也指定相同。 您需要在此处添加一组 LatLng 值 -> points:[] in routeOptions

    【讨论】:

    • 谢谢 Suraj,我想是的,虽然我正在制作一个在行走时构建路径的应用程序,所以我将 gps 坐标传递到折线中,所以当我启动它时它仍然是空的。我更改了代码,所以我在 gps 坐标上开始折线,它现在可以工作了,谢谢。如果人们有兴趣:我更改了“点”:[new LatLng(35,139)],它现在可以工作了。谢谢苏拉杰
    • 更新了指向cordova插件api而不是javascript api的答案
    猜你喜欢
    • 1970-01-01
    • 2014-12-21
    • 1970-01-01
    • 2018-01-13
    • 1970-01-01
    • 2019-07-15
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    相关资源
    最近更新 更多