angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

refreshing markers on the map

Open igorfeldman opened this issue 8 years ago • 3 comments

Hi, first of all many thanks for the library! its cutting my dev time to a fraction!

I have an issue with redrawing markers on the map when the model updates... I'm listening on bounds_changed (or idle) event, and pass the new bounds to a backend call to fetch corresponding markers. The map doesn't refresh with the new data right away, it takes a drags on the map for the markers to finally refresh.

I'm using the cluster and dorebuildall:

ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="map.options" bounds="map.bounds" events="{bounds_changed:reloadMarkers}">

ui-gmap-markers models="markers" coords="'self'" icon="'icon'" doCluster="true" events="map.markersEvents" dorebuildall="true">

in the controller:

$scope.reloadMarkers = function () { var box = { "swlng" : $scope.map.bounds.southwest.longitude, "swlat" : $scope.map.bounds.southwest.latitude, "nelng" : $scope.map.bounds.northeast.longitude, "nelat" : $scope.map.bounds.northeast.latitude };
dataService.fetchMarkers(box).then(function(result) {
$scope.markers = []; $scope.markers.push.apply($scope.markers, result.data);
}); }

Help is greatly appreciated! thanks!

igorfeldman avatar Oct 08 '15 20:10 igorfeldman

+1

diegoarcega avatar Apr 12 '16 13:04 diegoarcega

+100, Have you solved it in any other way ? refresh a marker's icon ?

TomaszWaszczyk avatar Aug 30 '16 08:08 TomaszWaszczyk

I am also facing the same issue. Has anybody solved it ?

trungvose avatar Sep 22 '16 01:09 trungvose