queryRenderedFeaturesInRect method
Implementation
@override
Future<List> queryRenderedFeaturesInRect(
Rect rect, List<String> layerIds, String? filter) async {
final options = <String, dynamic>{};
if (layerIds.isNotEmpty) {
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 as int?,
'geometry': {
'type': feature.geometry.type,
'coordinates': feature.geometry.coordinates,
},
'properties': feature.properties,
'source': feature.source,
})
.toList();
}