Skip to content

Commit

Permalink
Merge pull request #1189 from ushahidi/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
willdoran authored Jun 27, 2018
2 parents 3a3e14c + a8238dd commit 7d96f60
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/main/posts/views/post-view-map.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com

function PostViewMapLink($scope, element, attrs, controller) {
var map, markers;
var geoJsonLayers = [];
var limit = 200;
var requestBlockSize = 5;
var numberOfChunks = 0;
Expand Down Expand Up @@ -75,9 +76,13 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
}

function clearData() {
if (markers) {
map.removeLayer(markers);
if (geoJsonLayers.length > 0) {
angular.forEach(geoJsonLayers, function (layer) {
//map.removeLayer(layer)
layer.clearLayers();
});
markers = undefined;
geoJsonLayers = [];
}
}

Expand All @@ -100,6 +105,7 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
markers = geojson;
}
markers.addTo(map);
geoJsonLayers.push(markers);

if (posts.features.length > 0) {
map.fitBounds(geojson.getBounds());
Expand Down

0 comments on commit 7d96f60

Please sign in to comment.