Description

The "Search Intersects" beta endpoint allows you to search a region of many Geographies at once on the earth using a polygon search area of any size, drawn anti-clockwise.

Proto Definition


service BGSearchBeta {
	rpc BetaSearchIntersects (BetaSearchIntersectsArgs) returns (stream BetaSearchResult){}
}

Input Message

Name: BetaSearchIntersectsArgs

AttributeTypeDescription
collectionstringThe collection to search.
search_geometryPolygon | lat_Lng_bboxThe Geography used to search on the surface of the earth. Please reference Polygon & LatLngBBox.
controlsBetaSearchControlsControlling whether you would like to obtain the geometries only, or payload, or both, as well as controlling the level of aggregation returned.

BetaSearchControls:

AttributeTypeDescription
return_geometriesboolControls whether the search returns geometries (it'll always return IDs).
return_payloadsboolControls whether the search returns payloads associated with geometries.
geometries_chunk_sizeuint64Controls the number of geometries returned in each streamed BetaSearchResult message. If 0 is passed, it'll return the search result geometries one by one which is very slow.
aggregates_chunk_sizeuint64Controls the number of aggregated triangles returned in each streamed BetaSearchResult message. If 0 is passed, it'll return the search result triangles one by one which is very slow.
aggregationArgsAggregationArgs?Controls the aggregation behaviour. If it's not set, no aggregation happens.

AggregationArgs:

AttributeTypeDescription
max_geoms_per_celluint64The maximum number of geometries before BG-Search returns an aggregate view for that cell. A good value depends on your data but a reasonable range is between 50 to 200. Lower number means more aggressive aggregation.
resolution_offsetuint64Controls the resolution of the aggregated cells returned. a good range of values in 2 to 4.
max_additional_refinesuint64The maximum additional refinement for the aggregated cells. It should be 0 for most use cases.
count_refine_factordoubleThis a threshold for when to do the additional refinement aggregate. Use 1.0 for start.
message AggregationArgs {
  uint64 max_geoms_per_cell = 1;
  uint64 resolution_offset = 2;
  uint64 max_additional_refines = 3;
  double count_refine_factor = 4;
}

message BetaSearchControls {
  bool return_geometries = 1;
  bool return_payloads = 2;
  uint64 geometries_chunk_size = 3;
  uint64 aggregates_chunk_size = 4;
  optional AggregationArgs aggregationArgs = 5;
};

message BetaSearchIntersectsArgs {
  string collection = 1;
  oneof search_geometry {
    // LatLng point = 2;
    // LineStrip line_strip = 3;
    Polygon polygon = 4;
    LatLngBBox lat_Lng_bbox = 5;
  };
  reserved 2, 3;
  reserved "point", "line_strip";
  reserved 6 to 14;
  BetaSearchControls controls = 15;
}

Output Message

A stream of the Results from the search containing aggregated Triangles and individual Geographies that are sparse enough to not be aggregated.

The result is either a Geometry or Aggregate, the description of each is given below:

Geometry:

AttributeTypeDescription
idGeometryIdThe id of the Geometry, more information can be found here.
GeometryIndexableGeometryThe Geometry found from the search, with a type defined here.
payloadPayloadThe payload associated with this Geometry, more information about this type can be found here.

Aggregate:

AttributeTypeDescription
cell_indexDGGSIndexThe corresponding DGGSIndex of the aggregated cell. This type is the same as that returned by PointToDGGSIndex.
cell_verticesRingThe Ring denoting the vertices of the triangle on the earth. Information about the Ring type can be found here.
point_countuint64The number of LatLng contained in this aggregate Triangle.
non_point_countuint64The number of Geometries excluding LatLng contained in this aggregate Triangle.
mean_pointLatLngThe mean point used to represent the aggregate cell in LatLng for heatmap visualization.

BetaSearchResult

AttributeTypeDescription
geometriesGeometry[]A list of the Geometries found as a result of this search.
aggregatesAggregate[]A list of the aggregated triangles containing more information.
message BetaSearchResult {
  message Geometry {
    GeometryID id = 1;
    optional IndexableGeometry geometry = 2;
    optional Payload payload = 3;
  }
  // Subject to change
  message Aggregate {
    DGGSIndex cell_index = 1;
    Ring cell_vertices = 2;
    uint64 point_count = 3;
    uint64 non_point_count = 4;
    LatLng mean_point = 5;
  }

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