Skip to content

Commit

Permalink
feat(download): Filter phenomenons
Browse files Browse the repository at this point in the history
Just show the available phenomenons/sensors of stations inside the bbox

closes #267
  • Loading branch information
mpfeil committed May 4, 2018
1 parent a776996 commit 04d190e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/scripts/controllers/sidebar.download.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
function activate () {
Sidebar.setTitle('Download');
vm.markersFiltered = OpenSenseMapData.getMarkers();
vm.downloadMarkers = vm.markersFiltered;
vm.count = Object.keys(vm.markersFiltered).length;

osemMapData.getMap('map_main')
Expand Down Expand Up @@ -113,9 +114,11 @@
function getBoxIdsFromBBox (map){
var boxids = [];
var bbox = map.getBounds();
vm.downloadMarkers = [];
angular.forEach(vm.markersFiltered, function(marker, key) {
if (bbox.contains([marker.latLng[0],marker.latLng[1]])) {
boxids.push(marker.station._id);
vm.downloadMarkers.push(marker);
}
});
return boxids;
Expand Down
2 changes: 1 addition & 1 deletion app/views/explore2.sidebar.download.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<label>{{ "DOWNLOAD_SELECTSENSOR" | translate }}</label>
<select class="form-control" ng-model="download.inputFilter.Phenomenon">
<option value=""></option>
<option ng-repeat="m in download.markersFiltered | uniquePhenomenons | orderBy:m">{{ m }}</option>
<option ng-repeat="m in download.downloadMarkers | uniquePhenomenons | orderBy:m">{{ m }}</option>
</select>
<br>
<label>{{"COLUMNS"|translate}}</label>
Expand Down

0 comments on commit 04d190e

Please sign in to comment.