save_rois#
- movement.roi.save_rois(rois, file)[source]#
Save a collection of regions of interest (RoIs) to a GeoJSON file.
The RoIs are saved as a GeoJSON FeatureCollection, with each RoI represented as a Feature containing its geometry and properties (name and RoI type).
- Parameters:
rois (
Sequence[BaseRegionOfInterest]) – The regions of interest to save.file (
str|Path) – Path to the output file. Should have a.geojsonor a.jsonextension.
See also
load_roisLoad a collection of RoIs from a GeoJSON file.
- Return type:
Examples
Create a polygon and a line, then save them to a GeoJSON file:
>>> from movement.roi import LineOfInterest, PolygonOfInterest, save_rois >>> square = PolygonOfInterest( ... [(0, 0), (1, 0), (1, 1), (0, 1)], name="square" ... ) >>> diagonal = LineOfInterest([(0, 0), (1, 1)], name="diagonal") >>> save_rois([square, diagonal], "/path/to/rois.geojson")
Examples using save_rois#
Compute distances and angles to regions of interest
Compute distances and angles to regions of interest