aboutsummaryrefslogtreecommitdiff
path: root/resources/map.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/map.js')
-rw-r--r--resources/map.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/resources/map.js b/resources/map.js
index 8159514..42eea93 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -221,9 +221,7 @@ function initMap(self) {
layer.bindPopup(self.editorTemplate({coordinate: center}) +
self.healthPostTemplate(feature.properties) +
- '<div id="' + catchmentArea.id + '">' +
- self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, feature)) +
- '</div>');
+ self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, feature)));
self.markers[feature.id] = layer;
},
@@ -329,7 +327,18 @@ function displayMap(self, map) {
});
self.settlementsLayerGroup.addLayer(self.catchmentAreaSettlementsLayers[catchmentArea.id]);
- $('#' + catchmentArea.id).html(self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, self.healthPosts[catchmentArea.properties["subject"]])));
+ var healthPost = self.healthPosts[catchmentArea.properties.subject];
+
+ var center;
+ if (healthPost.geometry.type === "Point") {
+ center = healthPost.geometry.coordinates;
+ } else {
+ center = healthPost.geometry.coordinates[0];
+ }
+
+ self.markers[catchmentArea.properties.subject].bindPopup(self.editorTemplate({coordinate: center}) +
+ self.healthPostTemplate(healthPost.properties) +
+ self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, healthPost)));
}
}