d-wasserman / proximity-analysis

These ArcGIS Python scripts enable various types of proximity analysis leveraging spatial weights matrices & other proximity tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

proximity-analysis

This repository documents ArcMap and ArcGIS Pro python based geoprocessing tools used to assist in proximity analysis related tasks. The tools within make use of Near-Analysis functionality and spatial weights matrices to compute euclidean and network based proximty metrics.

Compute Neighborhood Statistics

This tool will use spatial weights matrices (SWM) to enable neighborhood statistics between polygons.

Summary

This tool will use spatial weights matrices to enable neighborhood statistics between polygons. The neighborhood statistics enabled are neighborhood sums, averages, and standard deviations.

Parameters

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Input feature class that relates to the input SWM file. Has the fields to develop neighborhood statistics on.

Feature Class
Fields_to_Focalize Dialog Reference

The fields from the input feature class to develop neighborhood statistics on.

Multiple Value
Spatial Weights Matrix Dialog Reference

The spatial weights matrix file (SWM).

SWM File
Ouput_Feature_Class Dialog Reference

Output feature class location with the focalized fields.

Feature Class
Use_Weights Dialog Reference

Indicates whether to use the weights embedded in the SWM. This is default.

Boolean
Compute_Sum Dialog Reference

Indicates whether to compute the neighborhood sum based on the spatial weights matrix.

Boolean
Compute_Average Dialog Reference

Indicates whether to compute the neighborhood mean based on the spatial weights matrix.

Boolean
Compute_Standard_Deviation Dialog Reference

Indicates whether to compute the neighborhood standard deviation based on the spatial weights matrix.

Boolean

Chained Near (Analysis)

This tool will conduct a chained near analysis creating multiple near proximity fields for each near feature class given to it.

Summary

This tool will conduct a near analysis that will add a new field for every Near Feature input into the Input Features dataset. Unlike Near, this tool will create a column wise set of Near fields for every Near Feature rather than using the closest of all the near features input into the tool. This results in many more fields, so use this only if you have a specific need to know proximity for every feature within the Input Feature class. Consider a Near Table if you want more detailed proximity information and are comfortable with a higher number of records.

Parameters

Parameter Explanation Data Type
Input_Features Dialog Reference

The input features that can be point, polyline, polygon, or multipoint type. Will have new fields added to it.

Feature Class
Near_Features Dialog Reference

One or more feature layers or feature classes containing near feature candidates. The near features can be of point, polyline, polygon, or multipoint. If mutliple features are chosen, each one will be given a separate field in the form of "DIST_{Feature Class Name}", or "ANGLE_{Feature Class Name}. Field names are validated so may be subject to truncation if the RDBMS requires it (shapefile).

Multiple Value
Search_Radius (Optional) Dialog Reference

The radius used to search for near features. If no value is specified, all near features are considered. If a distance but no unit or unknown is specified, the units of the coordinate system of the input features are used. If the Geodesic option is used, a linear unit such as Kilometers or Miles should be used.

Linear unit
Location (Optional) Dialog Reference

Specifies whether x- and y-coordinates of the closest location of the near feature will be written to the X_{Feature Class Name} and Y_{Feature Class Name} fields.

NO_LOCATION - Location information will not be written to the output table. This is the default.

LOCATION - Location information will be written to the output table.

Boolean
Angle (Optional) Dialog Reference

Specifies whether the near angle will be calculated and written to a ANGLE_{Feature Name} field in the output table. A near angle measures direction of the line connecting an input feature to its nearest feature at their closest locations. When the PLANAR method is used in the method parameter, the angle is within the range of -180 to 180, with 0 to the east, 90 to the north, 180 (or -180) to the west, and -90 to the south. When the GEODESIC method is used, the angle is within the range of -180 to 180, with 0 to the north, 90 to the east, 180 (or -180) to the south, and -90 to the west.

NO_ANGLE -The near angle values will not be written. This is the default.

ANGLE - The near angle values will be written to the ANGLE_{Feature Class Name} field.

Boolean
Transfer FID (Optional) Dialog Reference

If True, the FID of the Near Feature will be transferred to the input feature class along side the NEAR_Distance.

Boolean
Method (Optional) Dialog Reference

Determines whether to use a shortest path on a spheroid (geodesic) or a flat earth (planar) method. It is strongly suggested to use the Geodesic method with data stored in a coordinate system that is not appropriate for distance measurements (for example, Web Mercator or any geographic coordinate system) and any analysis that spans a large geographic area.

PLANAR -Uses planar distances between the features. This is the default.

GEODESIC -Uses geodesic distances between features. This method takes into account the curvature of the spheroid and correctly deals with data near the dateline and poles.

String

Chained Near Query Filter (Analysis)

This tool will conduct a chained near analysis creating multiple near proximity fields for each layer generated based on a chosen fields unique values by a Make Feature Layer query.

Summary

This tool will conduct a near analysis that will add a new field for every unique value found in the Near Feature Filter Field relative to the Input Features dataset. Unlike Near, this tool will create multiple column wise near fields for every unique set of field values within the Near Feature that is being compared to the Input Feature class. This tool is the same as making a feature layer for every unique value in the Near Feature and then running a Near Analysis tool on each of the output query layers.

Parameters

Parameter Explanation Data Type
Input_Features Dialog Reference

The input features that can be point, polyline, polygon, or multipoint type. Will have new fields added to it.

Feature Class
Near_Feature Dialog Reference

One feature class that will have a field chosen to generate unique layers for comparison to the Input features. The near features can be of point, polyline, polygon, or multipoint. For each layer generated, each one will be given a separate field in the form of "DIST_{Feature Layer Name}", or "ANGLE_{Feature Layer Name}. Field names are validated so may be subject to truncation if the RDBMS requires it (shapefile).

Multiple Value
Near_Feature_Field Dialog Reference

This is the field that is used to generate unique near feature sets that will be compared to the Input Feature class.

Single Value
Search_Radius (Optional) Dialog Reference

The radius used to search for near features. If no value is specified, all near features are considered. If a distance but no unit or unknown is specified, the units of the coordinate system of the input features are used. If the Geodesic option is used, a linear unit such as Kilometers or Miles should be used.

Linear unit
Location (Optional) Dialog Reference

Specifies whether x- and y-coordinates of the closest location of the near feature will be written to the X_{Feature Class Name} and Y_{Feature Class Name} fields.

NO_LOCATION - Location information will not be written to the output table. This is the default.

LOCATION - Location information will be written to the output table.

Boolean
Angle (Optional) Dialog Reference

Specifies whether the near angle will be calculated and written to a ANGLE_{Feature Name} field in the output table. A near angle measures direction of the line connecting an input feature to its nearest feature at their closest locations. When the PLANAR method is used in the method parameter, the angle is within the range of -180 to 180, with 0 to the east, 90 to the north, 180 (or -180) to the west, and -90 to the south. When the GEODESIC method is used, the angle is within the range of -180 to 180, with 0 to the north, 90 to the east, 180 (or -180) to the south, and -90 to the west.

NO_ANGLE -The near angle values will not be written. This is the default.

ANGLE - The near angle values will be written to the ANGLE_{Feature Class Name} field.

Boolean
Transfer FID (Optional) Dialog Reference

If True, the FID of the Near Feature will be transferred to the input feature class along side the NEAR_Distance.

Boolean
Method (Optional) Dialog Reference

Determines whether to use a shortest path on a spheroid (geodesic) or a flat earth (planar) method. It is strongly suggested to use the Geodesic method with data stored in a coordinate system that is not appropriate for distance measurements (for example, Web Mercator or any geographic coordinate system) and any analysis that spans a large geographic area.

PLANAR -Uses planar distances between the features. This is the default.

GEODESIC -Uses geodesic distances between features. This method takes into account the curvature of the spheroid and correctly deals with data near the dateline and poles.

String

Chained Scoring (Analysis)

This tool score incoming features based on selected fields by checking if it is below a threshold for each field and then returning chosen values for if it is greater than or less than the threshold.

Summary

This tool will score every field selected by the tool, and return a value based on whether the value for that field (IE Proximity), is less than or equal to the set threshold. This tool is intended to be used with the Chained Near Analysis tool, and will even remove the "DIST_" or "ANGLE_" text elements of the new created field names when scoring proximity fields.

Parameters

Parameter Explanation Data Type
Input_Features Dialog Reference

The input features that can be point, polyline, polygon, or multipoint type. Will have new fields added to it.

Feature Class
Fields_to_Score Dialog Reference

These are the fields that will be compared against the threshold value chosen, and then will be used to generate new scoring fields based on the passed field names.

___________________

Python Reference

new_score_fields= [arcpy.ValidateFieldName("SCORE_{0}".format(str(i).replace("DIST_", "", 1).replace("ANGLE_", "", 1)),workspace) for i in fields_list]

Multiple Value
Score_Threshold_Upper Dialog Reference

This represents the upper value of the near values that will be considered for scoring in a proximity analysis. If the value is greater than or equal to this value and below the upper threshold value, it is considered "Within" the threshold.

Double
Score_Threshold_Lower Dialog Reference

This represents the lower value of the near values that will be considered for scoring in a proximity analysis. If the value is greater than or equal to this value and below the upper threshold value, it is considered "Within" the threshold

Double
Score_If_WithinThreshold Dialog Reference

This is the score the field will have if it is within the threshold value bounds.

Double
Score_If_Outside_Threshold Dialog Reference

This is the score the field will have if it is outside the threshold value bounds.

Double

About

These ArcGIS Python scripts enable various types of proximity analysis leveraging spatial weights matrices & other proximity tools.

License:Apache License 2.0


Languages

Language:Python 100.0%