Distance Calculation

Instructions for Use

Distance Calculation can be used to calculate the distance from the source data to a point, line, or polygon. It can also calculate the distance from points, lines, or polygons within a specified query range to the calculated data. The calculation results are saved in a new attribute table, including the ID of the source data point, the ID of the adjacent feature (point, line, or polygon), and the distance value between them. The distributed tool can be used for distance calculation with larger amounts of data.

The distance calculation feature can be used to examine the proximity relationship between two sets of objects. For example, if you need to compare the distance between various types of business points (such as cinemas, fast food restaurants, engineering companies, or hardware stores) and community issues (littering, broken windows, graffiti), you can limit the search to one kilometer to find the relationship. Then calculate the distance between the businesses and community issues and save it in an attribute table. The result can be used to arrange public trash cans or police patrol routes.

Distance calculation can also be used to find all water wells within a specified range of a polluted well and their distances. It can be used to determine whether the distance of the reclassified farmland results to residential areas, rural areas, road networks, and farmland meets the requirements.

Parameter Description

Parameter Name Default Value Parameter Description Parameter Type
Input Feature Dataset   Sets the source dataset, which supports point, line, and polygon datasets as input feature datasets. FeatureRDD
Adjacent Feature Dataset   Sets the adjacent feature dataset, which supports point, line, and polygon datasets. FeatureRDD
Unique ID Field of Source Data (Optional)   Specifies a field as the unique ID of the source dataset, which is used to identify objects in the result attribute table. The default value is SmID. String
Unique ID Field of Adjacent Data (Optional)   Specifies a field as the unique ID of the adjacent dataset, which is used to identify objects in the result attribute table. The default value is SmID. String
Calculation Method (Optional) Nearest Distance Sets the calculation method for distance calculation, including the nearest distance and the distance within range. Nearest Distance: Calculates the distance between the adjacent objects within the query range and the source objects based on the points in the source dataset, and records the IDs and distance values of the nearest one or more objects in the result attribute table. Distance within Range: Calculates the distance between each point object in the source dataset and each adjacent object, and returns the IDs and distance values of all objects within the maximum and minimum distances specified. JavaComputeMethod
Minimum Distance 0.0 meters After setting the minimum distance, only the adjacent objects whose distance from the source data objects is greater than or equal to the minimum distance will be involved in the calculation. This value cannot be less than 0 and the default value is 0 meters. JavaDistance
Maximum Distance 100.0 meters After setting a maximum distance greater than 0, only the adjacent objects whose distance from the source data objects is less than or equal to the maximum distance will be involved in the calculation. This value cannot be less than the minimum distance. The default value is 100 meters. If you want to have no limit on the maximum distance, set the parameter to -1 meters. JavaDistance

Output Result

Parameter Name Parameter Description Parameter Type
Distance Calculation Result Dataset The attribute table of the distance calculation results. The fields include: Source Data ID, Adjacent Feature ID, and the distance value between them, with the unit consistent with the source data coordinates. FeatureRDD

Considerations:

  • The coordinate system of the source dataset and the adjacent dataset must be the same in order to perform distance calculation. The distance unit in the calculation result is consistent with the unit of the dataset coordinate system.
  • When there are multiple adjacent objects with the same distance from the source object, the IDs and distance of these adjacent objects will be recorded in the result attribute table.
  • When calculating the distance between two objects, if there is containment or (partial) overlap, the distance is 0. For example, if a point object is on a line object or inside a polygon object, the distance between them is 0.
  • If there are polygon objects in the calculation, the distance is calculated based on the boundaries of the polygon objects.