boxes_to_geojson#

boxes_to_geojson(boxes: Sequence[Box], class_ids: Sequence[int], crs_transformer: CRSTransformer, class_config: ClassConfig, scores: Optional[Sequence[Union[float, Sequence[float]]]] = None, bbox: Box | None = None) dict[source]#

Convert boxes and associated data into a GeoJSON dict.

Parameters:
  • boxes (Sequence[Box]) – List of Box in pixel row/col format.

  • class_ids (Sequence[int]) – List of int (one for each box)

  • crs_transformer (CRSTransformer) – CRSTransformer used to convert pixel coords to map coords in the GeoJSON.

  • class_config (ClassConfig) – ClassConfig

  • scores (Optional[Sequence[Union[float, Sequence[float]]]]) – Optional list of score or scores. If floats (one for each box), property name will be “score”. If lists of floats, property name will be “scores”. Defaults to None.

  • bbox (Box | None) – User-specified crop of the extent. Must be provided if the corresponding RasterSource has bbox != extent.

Returns:

Serialized GeoJSON.

Return type:

dict