natcap.invest.reports.vector_utils

natcap.invest.reports.vector_utils.get_geojson_bbox(geodataframe)

Get the bounding box of a GeoDataFrame as a GeoJSON feature.

Also calculate its aspect ratio. These are useful for cropping other layers in altair plots.

Parameters:

geodataframe (geopandas.GeoDataFrame)

Returns:

A 2-tuple containing:
  • extent_feature (dict): A GeoJSON feature representing the bounding box of the input GeoDataFrame.

  • xy_ratio (float): The aspect ratio of the bounding box (width/height).

Return type:

tuple