cars.core.roi_tools

This module contains tools for ROI

Module Contents

Functions

generate_roi_poly_from_inputs(roi)

Generate ROI polygon from roi inputs

resample_polygon(roi_poly, roi_epsg[, resolution])

Resample input polygon to given resolution.

geojson_to_shapely(geojson_dict)

Transform Geojson dict to Shapely polygon

parse_roi_file(→ Tuple[List[float], int])

Parse ROI file argument and generate bounding box

bounds_to_poly(bounds)

Convert bounds to polygon

cars.core.roi_tools.generate_roi_poly_from_inputs(roi)

Generate ROI polygon from roi inputs

Parameters

roi (str Or GeoJson Dict) – roi file path or Geojson

:return polygon, polygon epsg :rtype: Tuple(Shapely Polygon, int)

cars.core.roi_tools.resample_polygon(roi_poly, roi_epsg, resolution=100)

Resample input polygon to given resolution. No interpolation is applied.

Parameters
  • roi_poly (Shapely Polygon or MultiPolygon) – input polygon or multipolygon

  • roi_epsg (int) – roi epsg

  • resolution (float) – resolution in meter to resample to

Returns

resampled polygon

Return type

Shapely Polygon or MultiPolygon

cars.core.roi_tools.geojson_to_shapely(geojson_dict: dict)

Transform Geojson dict to Shapely polygon

Parameters

geojson_dict (dict) – geojson

Returns

shapely polygon

Return type

Shapely Polygon

cars.core.roi_tools.parse_roi_file(arg_roi_file: str) Tuple[List[float], int]

Parse ROI file argument and generate bounding box

:param arg_roi_file : ROI file argument :return: ROI Polygon + ROI epsg :rtype: Shapely polygon, int

cars.core.roi_tools.bounds_to_poly(bounds)

Convert bounds to polygon

Parameters

bounds – bounds: [xmin, ymin, xmax, ymax]

Type

bounds: list

:return polygon