Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Commit

Permalink
Only get properties from valid geojson data objects
Browse files Browse the repository at this point in the history
jbeezley committed Dec 5, 2016
1 parent 423574e commit 9a95646
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web_external/js/views/widgets/WMSFeatureInfoWidget.js
Original file line number Diff line number Diff line change
@@ -15,12 +15,17 @@ minerva.views.WmsFeatureInfoWidget = minerva.View.extend({
_.chain(that.parentView.collection.models)
.filter(function (set) { return set.get('displayed') && set.getDatasetType() === 'geojson'; })
.map(function (dataset) {
var i;
var layer = {};
var features = dataset.geoJsLayer.features();
_.each(features, function (feature) {
var hits = feature.pointSearch(event.geo);
if (hits && hits.found.length !== 0) {
layer['properties'] = hits.found[0].properties;
if (hits && hits.found) {
for (i = hits.found.length - 1; i >= 0; i -= 1) {
if (hits.found[i].properties) {
layer['properties'] = hits.found[i].properties;
}
}
}
});
layer['id'] = dataset.get('name');

0 comments on commit 9a95646

Please sign in to comment.