ValidROICollectionGeoJSON#
- class movement.validators.files.ValidROICollectionGeoJSON(file)[source]#
Bases:
objectClass for validating GeoJSON FeatureCollection files.
The validator ensures that the file:
is well-formed JSON.
conforms to the RoI Collection GeoJSON schema, which checks that the file contains a GeoJSON FeatureCollection containing
movement-compatible regions of interest (as produced bysave_rois()).
Additionally, it performs a custom validation step to ensure that each Feature’s
roi_typeproperty is consistent with its geometry type (e.g. “PolygonOfInterest” must have geometry type “Polygon”).- Raises:
ValueError – If the file is not valid JSON or does not match the expected schema.
TypeError – If
roi_typeproperty does not match the actual geometry type.
See also
movement.roi.save_roisSave a collection of RoIs to a GeoJSON file.
movement.roi.load_roisLoad a collection of RoIs from a GeoJSON file.
- schema: ClassVar[Mapping[str, Any]] = {'$schema': 'https://json-schema.org/draft/2020-12/schema', 'description': 'Schema for validating GeoJSON FeatureCollection files containing RoIs', 'properties': {'features': {'items': {'properties': {'geometry': {'properties': {'coordinates': {'type': 'array'}, 'type': {'enum': ['Polygon', 'LineString', 'LinearRing']}}, 'required': ['type', 'coordinates'], 'type': 'object'}, 'properties': {'oneOf': [{'type': 'null'}, {'properties': {'name': {'type': 'string'}, 'roi_type': {'enum': ['PolygonOfInterest', 'LineOfInterest']}}, 'type': 'object'}]}, 'type': {'const': 'Feature'}}, 'required': ['type', 'geometry'], 'type': 'object'}, 'type': 'array'}, 'type': {'const': 'FeatureCollection'}}, 'required': ['type', 'features'], 'title': 'RoI Collection GeoJSON', 'type': 'object'}#
JSON schema for validating the structure of the GeoJSON file.