RSGISLib Vector Geometry Module

Convert Geometries

rsgislib.vectorgeoms.convert_polygon_to_polyline(vec_poly_file: str, vec_poly_lyr: str, vec_line_file: str, vec_line_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function to convert a polygon vector file to a polyline file.

Parameters
  • vec_poly_file – Input polygon vector file

  • vec_poly_lyr – The name of the vector layer

  • vec_line_file – The output vector file

  • vec_line_lyr – The output vector layer name

  • out_format – The output vector file format (default: GPKG).

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.convert_polys_to_lines_gp(vec_poly_file: str, vec_poly_lyr: str, vec_line_file: str, vec_line_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False, exterior_lines: bool = False)

A function to convert a polygon vector file to a polyline file using geopandas.

Parameters
  • vec_poly_file – Input polygon vector file

  • vec_poly_lyr – The name of the vector layer

  • vec_line_file – The output vector file

  • vec_line_lyr – The output vector layer name

  • out_format – The output vector file format (default: GPKG).

  • del_exist_vec – remove output file if it exists.

  • exterior_lines – If True then only the outer exterior lines are outputted.

rsgislib.vectorgeoms.convert_multi_geoms_to_single(vec_file: str, vec_lyr: str, out_format: str, out_vec_file: str, out_vec_lyr: str, del_exist_vec: bool = False)

A convert any multiple geometries into single geometries.

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

  • out_format – the format driver for the output vector file (e.g., GPKG, ESRI Shapefile).

  • out_vec_file – output file path for the vector.

  • out_vec_lyr – output vector layer name.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.explode_vec_lyr(vec_file: str, vec_lyr: str, out_vec_file: str, out_vec_lyr: str, out_format: str = 'GPKG')

A function to explode a vector layer separating any multiple geometries (e.g., multipolygons) to single geometries.

Note. this function uses geopandas and therefore the vector layer is loaded into memory.

Parameters
  • vec_file – vector layer file

  • vec_lyr – vector layer name

  • out_vec_file – output vector layer file

  • out_vec_lyr – output vector layer name (Can be None if output format is not GPKG).

  • out_format – The output format for the vector file.

rsgislib.vectorgeoms.explode_vec_files(in_vec_files: list, output_dir: str, out_format: str = 'GPKG', out_vec_ext: str = 'gpkg')

A function which explodes the multiple geometries within a list of input layers. The output directory must be different to the directory the input files as the output file name will be the same as the input name.

Note. this function uses the explode_vec_lyr function which uses geopandas and therefore the vector layer is loaded into memory.

Parameters
  • in_vec_files – A list of input files.

  • output_dir – The directory where the output files will be placed.

  • out_format – The vector format for the outputs.

  • out_vec_ext – the file extension for the output files. There should not be a dot within the extension. e.g., gpkg, shp, geojson.

rsgislib.vectorgeoms.get_vec_lyr_as_pts(vec_file: str, vec_lyr: str) list

Get a list of points from the vectors within an input file.

Parameters
  • vec_file – Input vector file

  • vec_lyr – Input vector layer name

Returns

returns a list of points.

rsgislib.vectorgeoms.get_geom_pts(geom: osgeo.ogr.Geometry, pts_lst: Optional[list] = None) list

Recursive function which extracts all the points within the an OGR geometry.

Parameters
  • geom – The geometry from with the points are extracted.

  • pts_lst – The list for the points, if None a list will be created.

Returns

a list of points.

rsgislib.vectorgeoms.get_geoms_as_bboxs(vec_file: str, vec_lyr: str) list

A function which returns a list of bounding boxes for each feature within the vector layer.

Parameters
  • vec_file – vector file.

  • vec_lyr – layer within the vector file.

Returns

list of BBOXs

Calculate New Geometries

rsgislib.vectorgeoms.create_alpha_shape(vec_file: str, vec_lyr: str, out_vec_file: str, out_vec_lyr: str, out_format: str = 'GPKG', alpha_val: Optional[float] = None, alpha_vals: Optional[list] = None, max_iter: int = 10000, del_exist_vec: bool = False)

Function which calculate an alpha shape for a set of vector features (which are converted to points).

For this function to work you need the alphashapes module installed: https://alphashape.readthedocs.io https://github.com/bellockk/alphashape

Parameters
  • vec_file – the input vector file.

  • vec_lyr – the input vector layer name

  • out_vec_file – the output vector file.

  • out_vec_lyr – the name of the output vector layer (if None then the same as the input).

  • out_format – the output vector file format (e.g., GPKG)

  • alpha_val – The alpha value to create the the alpha shape polygon. If None then a value will be automatically calculate but warning this can a significant amount of time (i.e., hours!!)

  • alpha_vals – Alternatively, a list of alpha values can be provided (e.g., [75, 50, 25, 5, 2]) where first to produce a valid result will be outputted. i.e., the order you provide the alpha values will be the order they are tested. If None then the alpha_val parameter will be used.

  • max_iter – The maximum number of iterations for automatically selecting the alpha value. Note if the number iteration is not sufficient to find an optimum value then no value is returned.

  • del_exist_vec – remove output file if it exists.

Returns

(vec_output, alpha_val); vec_output is a boolean True an output produced; False no output, alpha_val - the alpha value used for the analysis. If a single value was inputted then the same value will be outputted.

rsgislib.vectorgeoms.calc_poly_centroids(vec_file: str, vec_lyr: str, out_format: str, out_vec_file: str, out_vec_lyr: str)

Create a vector layer of the polygon centroids.

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

  • out_format – the format driver for the output vector file (e.g., GPKG).

  • out_vec_file – output file path for the vector.

  • out_vec_lyr – output vector layer name.

rsgislib.vectorgeoms.vec_lyr_intersection_gp(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs an intersection between the vector layer and the overlain vector using Geopandas.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_difference_gp(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs a difference between the vector layer and the overlain vector using Geopandas.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_sym_difference_gp(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs a symmetric difference between the vector layer and the overlain vector using Geopandas.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_identity_gp(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs a identity between the vector layer and the overlain vector using Geopandas.

The result consists of the surface of vec_file, but with the geometries obtained from overlaying vec_file with vec_over_file.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_union_gp(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs a union between the vector layer and the overlain vector using Geopandas.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_intersection(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which performs an intersection between the vector layer and the overlain vector.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.vec_lyr_difference(vec_file: str, vec_lyr: str, vec_over_file: str, vec_over_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, out_format: str = 'GPKG', symmetric: bool = False, del_exist_vec: bool = False)

A function which performs an difference between the vector layer and the overlain vector.

Parameters
  • vec_file – Input vector file path.

  • vec_lyr – Input vector layer name.

  • vec_over_file – The vector file overlained on the input vector file.

  • vec_over_lyr – The vector layer overlained on the input vector file.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name.

  • out_format – The output file format of the vector file.

  • symmetric – If True then the symmetric difference will be taken.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.clip_vec_lyr(vec_file: str, vec_lyr: str, vec_roi_file: str, vec_roi_lyr: str, out_vec_file: str, out_vec_lyr: str, out_format: str = 'GPKG')

A function which clips a vector layer using an input region of interest (ROI) polygon layer.

Parameters
  • vec_file – Input vector file.

  • vec_lyr – Input vector layer within the input file.

  • vec_roi_file – Input vector file defining the ROI polygon(s)

  • vec_roi_lyr – Input vector layer within the roi input file.

  • out_vec_file – Output vector file

  • out_vec_lyr – Output vector layer name.

  • out_format – Output file format (default GPKG).

Edit Geometries

rsgislib.vectorgeoms.simplify_geometries(vec_file: str, vec_lyr: str, tolerance: float, out_format: str, out_vec_file: str, out_vec_lyr: str, del_exist_vec: bool = False)

Create a simplified version of the input

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

  • tolerance – simplification tolerance

  • out_format – the format driver for the output vector file (e.g., GPKG, ESRI Shapefile).

  • out_vec_file – output file path for the vector.

  • out_vec_lyr – output vector layer name.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.delete_polygon_holes(vec_file: str, vec_lyr: str, out_format: str, out_vec_file: str, out_vec_lyr: str, area_thres: Optional[float] = None, del_exist_vec: bool = False)

Delete holes from the input polygons in below the area threshold.

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

  • out_format – the format driver for the output vector file (e.g., GPKG, ESRI Shapefile).

  • out_vec_file – output file path for the vector.

  • out_vec_lyr – output vector layer name.

  • area_thres – threshold below which holes are removed. If threshold is None then all holes are removed.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.remove_polygon_area(vec_file: str, vec_lyr: str, out_format: str, out_vec_file: str, out_vec_lyr: str, area_thres: float, del_exist_vec: bool = False)

Delete polygons with an area below a defined threshold.

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

  • out_format – the format driver for the output vector file (e.g., GPKG, ESRI Shapefile).

  • out_vec_file – output file path for the vector.

  • out_vec_lyr – output vector layer name.

  • area_thres – threshold below which polygons are removed.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.shiftxy_vec_lyr(vec_file: str, vec_lyr: str, x_shift: float, y_shift: float, out_vec_file: str, out_vec_lyr: str, out_format: str = 'GPKG')

A function which shifts (translates) a vector layer in the x and y axis’.

Parameters
  • vec_file – Input vector file.

  • vec_lyr – Input vector layer within the input file.

  • x_shift – The shift in the x axis. In the units of the coordinate system the file is projected in.

  • y_shift – The shift in the y axis. In the units of the coordinate system the file is projected in.

  • out_vec_file – Output vector file

  • out_vec_lyr – Output vector layer name.

  • out_format – Output file format (default GPKG).

Geometry Tests

rsgislib.vectorgeoms.vec_intersects_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the comparison vector layer intersects with the base vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

rsgislib.vectorgeoms.vec_overlaps_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the comparison vector layer overlaps with the base vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

rsgislib.vectorgeoms.vec_within_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the comparison vector layer within with the base vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

rsgislib.vectorgeoms.vec_contains_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the base vector layer contains with the comparison vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

rsgislib.vectorgeoms.vec_touches_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the comparison vector layer touches the base vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

rsgislib.vectorgeoms.vec_crosses_vec(vec_base_file: str, vec_base_lyr: str, vec_comp_file: str, vec_comp_lyr: str) bool

Function to test whether the comparison vector layer touches the base vector layer.

Note. This function iterates through the geometries of both files performing a comparison and therefore can be very slow to execute for large vector files.

Parameters
  • vec_base_file – vector layer file used as the base layer

  • vec_base_lyr – vector layer used as the base layer

  • vec_comp_file – vector layer file used as the comparison layer

  • vec_comp_lyr – vector layer used as the comparison layer

Returns

boolean

Spatial Index

rsgislib.vectorgeoms.create_rtree_index(vec_file: str, vec_lyr: str)

A function which creates a spatial index using the rtree package for the inputted vector file/layer.

Parameters
  • vec_file – Input vector file to be processed.

  • vec_lyr – The layer within the vector file for which the index is to be built.

rsgislib.vectorgeoms.bbox_intersects_index(rt_idx, geom_lst: list, bbox: list) bool

A function which tests for intersection between the geometries and the bounding box using a spatial index.

Parameters
  • rt_idx – the rtree spatial index object (created using the create_rtree_index function)

  • geom_lst – the list of geometries as referenced in the index (created using the create_rtree_index function)

  • bbox – the bounding box (xMin, xMax, yMin, yMax). Same projection as geometries in the index.

Returns

True there is an intersection. False there is not an intersection.

Internal Utilities

rsgislib.vectorgeoms.get_pt_on_line(pt1: osgeo.ogr.Geometry, pt2: osgeo.ogr.Geometry, dist: float) -> (<class 'float'>, <class 'float'>)

A function that calculates a point on the vector defined by pt1 and pt2.

Parameters
  • pt1 – An ogr point geometry which has functions GetX() and GetY().

  • pt2 – An ogr point geometry which has functions GetX() and GetY().

  • dist – The distance from pt1 the new point is to be created.

Returns

The created point; returned as a set of floats: (x, y)

rsgislib.vectorgeoms.find_pt_to_side(pt_start: osgeo.ogr.Geometry, pt: osgeo.ogr.Geometry, pt_end: osgeo.ogr.Geometry, line_len: float, left_hand: bool = False) -> (<class 'float'>, <class 'float'>)

A function to calculate a point location at a right-angle to the vector defined by the points pt_start and pt_end at the location pt.

Parameters
  • pt_start – An ogr point geometry which has functions GetX(), GetY() and Distance().

  • pt – An ogr point geometry which has functions GetX(), GetY() and Distance().

  • pt_end – An ogr point geometry which has functions GetX(), GetY() and Distance().

  • line_len – The distance from the pt_start and pt_end vector to the new point.

  • left_hand – Specify which side the point is projected from the pt_start and pt_end vector. Default: False - project right-hand side of vector, True - project left-hand side of vector

Returns

The created point; returned as a set of floats: (x, y)

rsgislib.vectorgeoms.create_orthg_lines(in_vec_file: str, in_vec_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, pt_step: float = 1000, line_len: float = 10000, left_hand: bool = False, out_format: str = 'GPKG', del_exist_vec: bool = False)

A function to create a set of lines which are orthogonal to the lines of the input vector file.

Parameters
  • in_vec_file – The inputted vector file path - this should be a polyline vector file

  • in_vec_lyr – The name of the vector layer

  • out_vec_file – The output vector file path - this will be a polyline vector file

  • out_vec_lyr – The name of the output vector layer (if None then created as the same as the file name)

  • pt_step – The steps (in the unit of the coordinate system) along lines in the layer at which lines are created.

  • line_len – The length of the lines created.

  • left_hand – Specify which side the point is projected from the line (i.e., left or right side) Default: False - project right-hand side of vector, True - project left-hand side of vector

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.closest_line_intersection(vec_line_file: str, vec_line_lyr: str, vec_objs_file: str, vec_objs_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, start_x_field: str = 'start_x', start_y_field: str = 'start_y', uid_field: str = 'uid', out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which intersects each line within the input vector layer (vec_objs_file, vec_objs_lyr) creating a new line between the start point of the input layer (defined in the vector attribute table: start_x_field, start_y_field) and the intersection point which is closest to the start point.

Parameters
  • vec_line_file – Input lines vector file path.

  • vec_line_lyr – Input lines vector layer name.

  • vec_objs_file – The vector file for the objects (expecting polygons) to be intersected with.

  • vec_objs_lyr – The vector layer for the objects (expecting polygons) to be intersected with.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name

  • start_x_field – The field name for the start point X coordinate for the input lines.

  • start_y_field – The field name for the start point Y coordinate for the input lines.

  • uid_field – The field name for the Unique ID (UID) of the input lines.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.line_intersection_range(vec_line_file: str, vec_line_lyr: str, vec_objs_file: str, vec_objs_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, start_x_field: str = 'start_x', start_y_field: str = 'start_y', uid_field: str = 'uid', out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which intersects each line within the input vector layer (vec_objs_file, vec_objs_lyr) creating a new line between the closest intersection to the start point of the input layer (defined in the vector attribute table: start_x_field, start_y_field) and the intersection point which is furthest to the start point.

Parameters
  • vec_line_file – Input lines vector file path.

  • vec_line_lyr – Input lines vector layer name.

  • vec_objs_file – The vector file for the objects (expecting polygons) to be intersected with.

  • vec_objs_lyr – The vector layer for the objects (expecting polygons) to be intersected with.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name

  • start_x_field – The field name for the start point X coordinate for the input lines.

  • start_y_field – The field name for the start point Y coordinate for the input lines.

  • uid_field – The field name for the Unique ID (UID) of the input lines.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

rsgislib.vectorgeoms.scnd_line_intersection_range(vec_line_file: str, vec_line_lyr: str, vec_objs_file: str, vec_objs_lyr: str, out_vec_file: str, out_vec_lyr: Optional[str] = None, start_x_field: str = 'start_x', start_y_field: str = 'start_y', uid_field: str = 'uid', out_format: str = 'GPKG', del_exist_vec: bool = False)

A function which intersects a line with a set of polygons outputting the lines cut to their second point of intersection. Assume, first point of intersection would be entering the polygon and the second point of intersection would be leaving the polygon.

Parameters
  • vec_line_file – Input lines vector file path.

  • vec_line_lyr – Input lines vector layer name.

  • vec_objs_file – The vector file for the objects (expecting polygons) to be intersected with.

  • vec_objs_lyr – The vector layer for the objects (expecting polygons) to be intersected with.

  • out_vec_file – The output vector file path.

  • out_vec_lyr – The output vector layer name

  • start_x_field – The field name for the start point X coordinate for the input lines.

  • start_y_field – The field name for the start point Y coordinate for the input lines.

  • uid_field – The field name for the Unique ID (UID) of the input lines.

  • out_format – The output file format of the vector file.

  • del_exist_vec – remove output file if it exists.

Calculate Geometry Info

rsgislib.vectorgeoms.get_poly_hole_area(vec_file: str, vec_lyr: str)

Get an array of the areas of the polygon holes.

Parameters
  • vec_file – input vector file

  • vec_lyr – input vector layer within the input file.

Returns

A list of areas.