Я пытаюсь отфильтровать данные на картах яндекса. Пример CodePen
Если базовая станция имеет несколько полос (2G, 3G и 4G), то это должно быть в результатах, если хотя бы одна из ее полос находится в фильтре.
Как правильно фильтровать данные на картах Яндекса?
У меня есть listBoxControl with listBoxItems = ['2G', '3G', '4G']
MyФункция фильтра выглядит следующим образом:
function getFilterFunction(categories){
return function(obj){
let bsBands = obj.has_bands;
/* How correct filter data? */
return categories['2G'] && categories['3G'] && categories['4G'];
}
}
GeoJSON выглядит следующим образом:
{
"count": 4,
"next": null,
"previous": null,
"type": "FeatureCollection",
"features": [
{
"id": 1,
"region_prefix": "97",
"cell_site_number": 1,
"description": "",
"address": "",
"commissioning": "",
"bs_id": "",
"height_asl": 0,
"bands": [
{
"name": "2G",
"frequency": "900"
},
{
"name": "2G",
"frequency": "1800"
},
{
"name": "3G",
"frequency": "2100"
},
{
"name": "4G",
"frequency": "1800"
},
{
"name": "4G TDD",
"frequency": "2600"
}
],
"status": true,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [55.755815, 37.613]
},
"properties": {
"balloonContentHeader": "balloonContentHeader",
"balloonContentBody": "balloonContentBody",
"balloonContentFooter": "balloonContentFooter",
"clusterCaption": "clusterCaption",
"hintContent": "hintContent",
"iconCaption": "2G 3G 4G"
},
"has_bands": [
"3G",
"2G",
"4G"
]
},
{
"id": 2,
"region_prefix": "97",
"cell_site_number": 2,
"description": "",
"address": "",
"commissioning": "",
"bs_id": "",
"height_asl": 0,
"bands": [
{
"name": "2G",
"frequency": "900"
},
{
"name": "2G",
"frequency": "1800"
},
{
"name": "3G",
"frequency": "2100"
},
{
"name": "4G",
"frequency": "1800"
},
{
"name": "4G TDD",
"frequency": "2600"
}
],
"status": true,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [55.759, 37.613]
},
"properties": {
"balloonContentHeader": "balloonContentHeader",
"balloonContentBody": "balloonContentBody",
"balloonContentFooter": "balloonContentFooter",
"clusterCaption": "clusterCaption",
"hintContent": "hintContent",
"iconCaption": "2G 3G 4G"
},
"has_bands": [
"3G",
"2G",
"4G"
]
},
{
"id": 3,
"region_prefix": "97",
"cell_site_number": 3,
"description": "",
"address": "",
"commissioning": "",
"bs_id": "",
"height_asl": 0,
"bands": [
{
"name": "3G",
"frequency": "2100"
}
],
"status": true,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [55.7204, 37.6167]
},
"properties": {
"balloonContentHeader": "balloonContentHeader",
"balloonContentBody": "balloonContentBody",
"balloonContentFooter": "balloonContentFooter",
"clusterCaption": "clusterCaption",
"hintContent": "hintContent",
"iconCaption": "3G"
},
"has_bands": [
"3G",
]
},
{
"id": 4,
"region_prefix": "97",
"cell_site_number": 4,
"description": "",
"address": "",
"commissioning": "",
"bs_id": "",
"height_asl": 0,
"bands": [
{
"name": "4G",
"frequency": "1800"
},
{
"name": "4G TDD",
"frequency": "2600"
}
],
"status": true,
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [55.7704, 37.6119]
},
"properties": {
"balloonContentHeader": "balloonContentHeader",
"balloonContentBody": "balloonContentBody",
"balloonContentFooter": "balloonContentFooter",
"clusterCaption": "clusterCaption",
"hintContent": "hintContent",
"iconCaption": "4G"
},
"has_bands": [
"4G"
]
}]}