getNearestLocations method

List<Landmark> getNearestLocations(
  1. Coordinates coords, {
  2. List<int> lmkStoreTypesIds = const <int>[],
  3. int radius = 0,
})

Retrieves nearby landmarks at specified geographic coordinates.

Performs fast synchronous reverse geocoding to find landmarks near the specified coordinates. This is useful for identifying addresses, points of interest, cities, or roads at or near a given location without performing a full asynchronous search.

Supported landmark store types include LandmarkStoreType.mapAddress, LandmarkStoreType.mapPoi, LandmarkStoreType.mapCity, and LandmarkStoreType.mapRoads.

Parameters

  • coords: The reference Coordinates for the search center point
  • lmkStoreTypesIds: List of landmark store type IDs to search (see LandmarkStoreType). If empty, searches all supported landmark stores. Defaults to empty list
  • radius: Search radius in meters around the coordinates. If 0, uses an optimal default radius. Defaults to 0

Returns

  • List of Landmark objects representing the nearest locations to the coordinates, sorted by proximity, or an empty list if none found

See also:

Implementation

List<Landmark> getNearestLocations(
  Coordinates coords, {
  List<int> lmkStoreTypesIds = const <int>[],
  int radius = 0,
}) {
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapView',
    'getNearestLocations',
    args: <String, Object>{
      'coords': coords,
      'intList': lmkStoreTypesIds.isNotEmpty
          ? lmkStoreTypesIds
          : <dynamic, dynamic>{},
      'radius': radius,
    },
  );

  return LandmarkList.init(resultString['result']).toList();
}