readMapDataSingle method

  1. @override
Future<DatastoreBundle> readMapDataSingle(
  1. Tile tile
)

Reads map data for a single tile by filtering stored data.

Performs spatial filtering to return only POIs and ways that intersect with the tile's geographic boundaries.

Implementation

@override
Future<DatastoreBundle> readMapDataSingle(Tile tile) {
  List<PointOfInterest> poiResults = pointOfInterests.where((poi) => tile.getBoundingBox().containsLatLong(poi.position)).toList();
  List<Way> wayResults = [];
  for (Way way in ways) {
    if (tile.getBoundingBox().intersectsArea(way.latLongs)) {
      wayResults.add(way);
    }
  }
  return Future.value(DatastoreBundle(pointOfInterests: poiResults, ways: wayResults));
}