findClosest method

Future<BuildingInsights> findClosest({
  1. List<String>? experiments,
  2. double? location_latitude,
  3. double? location_longitude,
  4. String? requiredQuality,
  5. String? $fields,
})

Locates the building whose centroid is closest to a query point.

Returns an error with code NOT_FOUND if there are no buildings within approximately 50m of the query point.

Request parameters:

experiments - Optional. Specifies the pre-GA features to enable.

location_latitude - The latitude in degrees. It must be in the range [-90.0, +90.0].

location_longitude - The longitude in degrees. It must be in the range [-180.0, +180.0].

requiredQuality - Optional. The minimum quality level allowed in the results. No result with lower quality than this will be returned. Not specifying this is equivalent to restricting to HIGH quality only. Possible string values are:

  • "IMAGERY_QUALITY_UNSPECIFIED" : No quality is known.
  • "HIGH" : Solar data is derived from aerial imagery captured at low-altitude and processed at 0.1 m/pixel.
  • "MEDIUM" : Solar data is derived from enhanced aerial imagery captured at high-altitude and processed at 0.25 m/pixel.
  • "LOW" : Solar data is derived from enhanced satellite imagery processed at 0.25 m/pixel.
  • "BASE" : Solar data is derived from enhanced satellite imagery processed at 0.25 m/pixel.

$fields - Selector specifying which fields to include in a partial response.

Completes with a BuildingInsights.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<BuildingInsights> findClosest({
  core.List<core.String>? experiments,
  core.double? location_latitude,
  core.double? location_longitude,
  core.String? requiredQuality,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (experiments != null) 'experiments': experiments,
    if (location_latitude != null)
      'location.latitude': ['${location_latitude}'],
    if (location_longitude != null)
      'location.longitude': ['${location_longitude}'],
    if (requiredQuality != null) 'requiredQuality': [requiredQuality],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/buildingInsights:findClosest';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return BuildingInsights.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}