API Reference

Description

The SearchDistWithin endpoint enables you to identify geometries located within a specified distance, measured in meters, from the input geometry.

Proto Definition


service BGSearch {
      rpc SearchDistWithin (SearchDistWithinArgs) returns (stream SearchResult) {}
}

Input Message

Name: SearchDistWithinArgs

AttributetypeDescription
collectionstringThe name of the collection.
search_geometryLatLngThe geometry that we a going to search within radius of.
distance_mdoubleThe distance from the input geometry to search.
controlsSearchControlsControls of search

SearchControls:

AttributeTypeDescription
return_geometriesboolControls whether the search returns geometries (it'll always return IDs).
return_payloadsboolControls whether the search returns payloads associated with geometries.
chunk_sizeuint64Controls the number of geometries returned in each streamed SearchResult message. A number between 1,000 to 10,000 is optimal. If 0 is passed, it'll return the search result geometries one by one which is very slow.
message SearchControls {
  bool return_geometries = 1;
  bool return_payloads = 2;
  uint64 chunk_size = 3;
};

message SearchDistWithinArgs {
  string collection = 1;
  double distance_m = 2;
  oneof search_geometry {
    LatLng point = 3;
    // LineStrip line_strip = 4;
    // Polygon polygon = 5;
  };
  reserved 4 to 14;
  reserved "line_strip", "polygon";
  SearchControls controls = 15;
}

Output Message

Name: stream SearchResult

AttributeTypeDescription
geometriesGeometry[]The result of the search operation. Can only be Geometry[].
message SearchResult {
  message Geometry {
    GeometryID id = 1;
    optional IndexableGeometry geometry = 2;
    optional Payload payload = 3;
  }
  message Aggregate {
    // TODO this: This is done in Beta API
  }

  repeated Geometry geometries = 1;
  //repeated Aggregate aggregates = 2;

  reserved 2;
  reserved "aggregates";
}

Status Code

  • 5: NOT_FOUND if a collection with the provided name does not exist.