geofileops.isvalid#

geofileops.isvalid(input_path: Union[str, os.PathLike[Any]], output_path: Optional[Union[str, os.PathLike[Any]]] = None, only_invalid: bool = True, input_layer: Optional[str] = None, output_layer: Optional[str] = None, columns: Optional[List[str]] = None, explodecollections: bool = False, validate_attribute_data: bool = False, nb_parallel: int = -1, batchsize: int = -1, force: bool = False) bool#

Checks for all geometries in the geofile if they are valid.

The results are written to the output file.

If explodecollections is False and the input and output file type is GeoPackage, the fid will be preserved. In other cases this will typically not be the case.

Parameters:
  • input_path (PathLike) – The input file.

  • output_path (PathLike, optional) – The output file path. If not specified the result will be written in a new file alongside the input file. Defaults to None.

  • only_invalid (bool, optional) – if True, only put invalid results in the output file. Deprecated: always treated as True.

  • input_layer (str, optional) – input layer name. Optional if the file only contains one layer.

  • output_layer (str, optional) – input layer name. Optional if the file only contains one layer.

  • columns (List[str], optional) – list of columns to retain. If None, all standard columns are retained. In addition to standard columns, it is also possible to specify “fid”, a unique index available in all input files. Note that the “fid” will be aliased eg. to “fid_1”. Defaults to None.

  • explodecollections (bool, optional) – True to output only simple geometries. Defaults to False.

  • validate_attribute_data (bool, optional) – True to validate if all attribute data can be read. Defaults to False.

  • nb_parallel (int, optional) – the number of parallel processes to use. Defaults to -1: use all available CPUs.

  • batchsize (int, optional) – indicative number of rows to process per batch. A smaller batch size, possibly in combination with a smaller nb_parallel, will reduce the memory usage. Defaults to -1: (try to) determine optimal size automatically.

  • force (bool, optional) – overwrite existing output file(s). Defaults to False.

Returns:

True if all geometries were valid.

Return type:

bool