Skip to content

Commit

Permalink
implement new filter 'has_labels'
Browse files Browse the repository at this point in the history
  • Loading branch information
han16nah committed Oct 5, 2023
1 parent 5480360 commit d3c6b12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions webserver/pytreedb_server/static/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var filterKeys = {
"source": "properties.measurements.source",
"dbh": "properties.measurements.DBH_cm",
"height": "properties.measurements.height_m",
"crowndia.": "properties.measurements.mean_crown_diameter_m"
"crowndia.": "properties.measurements.mean_crown_diameter_m",
"labels": "properties.data.has_labels"
}
// Init leaflet map
var map = L.map('mapContainer').fitWorld();
Expand Down Expand Up @@ -774,6 +775,14 @@ updateAvailableVals = (newFilterID, field) => {
break;
case "Quality":
break;
case "Labels":
var has_labels = ['true', 'false'];
has_labels.forEach(cond => {
$(availableValuesEl).append(
'<li><a class="dropdown-item" onclick="fieldValueSelected(this)">' + cond + '</a></li>'
);
})
break;
default:
break;
}
Expand Down Expand Up @@ -986,4 +995,3 @@ cleanMap = () => {
map.invalidateSize(); // Make sure tiles render correctly
markers.clearLayers(); // Remove previous markers
}

1 change: 1 addition & 0 deletions webserver/pytreedb_server/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ <h1>Welcome to pytreedb</h1>
<li><a class="dropdown-item" onclick="addSearchFilter(this)">DBH</a></li>
<li><a class="dropdown-item" onclick="addSearchFilter(this)">Height</a></li>
<li><a class="dropdown-item" onclick="addSearchFilter(this)">CrownDia.</a></li>
<li><a class="dropdown-item" onclick="addSearchFilter(this)">Labels</a></li>
</ul>
</div>
<button type="button" class="btn btn-outline-success float-none" id="removeAllFilterBtn" onclick="cleanSearchBar()" style="display: inline-block; margin-right: -5rem;">Remove All</button>
Expand Down

0 comments on commit d3c6b12

Please sign in to comment.