Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 在平移或缩放之前,标记不会显示在地图上_Google Maps_Gwt_Google Maps Api 3_Google Maps Markers_Fitbounds - Fatal编程技术网

Google maps 在平移或缩放之前,标记不会显示在地图上

Google maps 在平移或缩放之前,标记不会显示在地图上,google-maps,gwt,google-maps-api-3,google-maps-markers,fitbounds,Google Maps,Gwt,Google Maps Api 3,Google Maps Markers,Fitbounds,我只有一个标记要显示在地图上。我得到了标记LatLng,并通过扩展标记泊松的LatLngBounds将其添加到地图中,并将边界拟合到地图上。 这是我使用的片段 GoogleMap map = GoogleMap.create(divWrapper.getElement(), mapOptions); LatLngBounds latLngBounds = LatLngBounds.create(); final Lat

我只有一个标记要显示在地图上。我得到了标记LatLng,并通过扩展标记泊松的LatLngBounds将其添加到地图中,并将边界拟合到地图上。 这是我使用的片段

             GoogleMap map = GoogleMap.create(divWrapper.getElement(), mapOptions);
             LatLngBounds latLngBounds = LatLngBounds.create();
             final LatLng latLngInstance = LatLng.create(((ResultModel)resultModel).getLocLat().doubleValue(), ((AssetMapViewerSiteModel)resultModel).getLocLong().doubleValue());
                MarkerOptions markerOptions = MarkerOptions.create();
                markerOptions.setPosition(latLngInstance);
                markerOptions.setTitle(((ResultModel)resultModel).getMarkerName());
               Marker marker = Marker.create(markerOptions);
                marker.setMap(map);
             latLngBounds.extend(marker.getPosition());
             map.setCenter(latLngBounds.getCenter());
             map.fitBounds(latLngBounds);
加载地图后,在我平移或缩放地图之前,我不会看到添加的标记。这个问题在我测试的浏览器Chrome和FireFox中都可以看到,所以看起来像是谷歌地图的问题

是否有解决此问题的方法或解决方法?
提前感谢。

我认为我们需要更多地了解您的代码否完整内容,您在其中创建映射和标记,您拥有的任何可能会影响事情的相关事件侦听器,etcI在这部分代码之前已初始化映射。只有当我只向地图添加一个标记时,才会看到此问题。如果我添加多个标记,它就可以正常工作。我在指向javascript api的链接中找不到
setPosition
-方法。此外,GWT的包装器也可以与相同的API一起使用。[链接]()