queryRenderedFeaturesInRect method
Implementation
@override
Future<List> queryRenderedFeaturesInRect(
Rect rect, List<String> layerIds, String? filter) async {
Map<String, dynamic> options = {};
if (layerIds.length > 0) {
options['layers'] = layerIds;
}
if (filter != null) {
options['filter'] = filter;
}
return _map
.queryRenderedFeatures([
[rect.left, rect.bottom],
[rect.right, rect.top],
], options)
.map((feature) => {
'type': 'Feature',
'id': feature.id,
'geometry': {
'type': feature.geometry.type,
'coordinates': feature.geometry.coordinates,
},
'properties': feature.properties,
'source': feature.source,
})
.toList();
}