geofileops.export_by_distance#
- geofileops.export_by_distance(input_to_select_from_path: str | os.PathLike[Any], input_to_compare_with_path: str | os.PathLike[Any], output_path: str | os.PathLike[Any], max_distance: float, input1_layer: str | None = None, input1_columns: list[str] | None = None, input2_layer: str | None = None, output_layer: str | None = None, gridsize: float = 0.0, where_post: str | None = None, nb_parallel: int | None = None, batchsize: int = -1, force: bool = False) None#
Exports all features within the distance specified.
Features in
input_to_select_from_paththat are within the distance specified of any features ininput_to_compare_with_path.- Parameters:
input_to_select_from_path (PathLike) – the 1st input file
input_to_compare_with_path (PathLike) – the 2nd input file
output_path (PathLike) – the file to write the result to
max_distance (float) – maximum distance
input1_layer (str, optional) – 1st input layer name. If None,
input_to_select_from_pathshould contain only one layer. Defaults to None.input1_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.
input2_layer (str, optional) – 2nd input layer name. If None,
input_to_compare_with_pathshould contain only one layer. Defaults to None.output_layer (str, optional) – output layer name. If None, the
output_pathstem is used. Defaults to None.gridsize (float, optional) – the size of the grid the coordinates of the ouput will be rounded to. Eg. 0.001 to keep 3 decimals. Value 0.0 doesn’t change the precision. Defaults to 0.0.
where_post (str, optional) – SQL filter to apply after all other processing, including e.g.
explodecollections. It should be in sqlite syntax and spatialite reference functions can be used. Defaults to None.nb_parallel (int | None, optional) – the number of parallel workers to use. If None, the preference set in the nb_parallel configuration option is used, which defaults to the number of CPU cores available. For more information, see
options.set_nb_parallel(). Defaults to None.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.
See also
export_by_bounds(): export features that intersect with the bounds specifiedexport_by_location(): export features that e.g. intersect with features of another layer