HOW TO
Point features represent specific coordinates when added to a map. These coordinates can also represent the exact location of a vantage point, such as watch towers or lighthouses. Polygons can be created from the direction of the point feature to visualize the angle of the survey area on the map.
This article describes the workflow on how to create polygon features representing the survey area of an observation using Python.
Note: The table used must contain the following five data: longitude, latitude, left bearing, right bearing, and distance.
def circle_section(x, y, start, end, radius, wkid): """Creates a circle section. x, y: float, coordinates of the center start, end: int, start and end of the section in degrees, Nort=0°, East=90° radius: float, radius of the section wkid: int, well-known id of the coordinate system returns an arcpy.Polygon in the chosen coordinate system """ start = int(start) end = int(end) center = arcpy.Point(x, y) center_geo = arcpy.PointGeometry(center, wkid) angles = range(start, end, 1) if start > end: angles = list(range(start, 360, 1)) + list(range(0, end, 1)) arc_geos = [center_geo.pointFromAngleAndDistance(angle, radius, "PLANAR") for angle in angles] points = [center] + [ag.firstPoint for ag in arc_geos] + [center] return arcpy.Polygon(arcpy.Array(points), spatial_reference=wkid) def create_view_sheds(in_table, out_features, x_field, y_field, bearing_left_field, bearing_right_field, distance_field, wkid): """Creates a polygon feature class with circle sections. in_table: str, path to the input table or name of the table in the active map out_features: str, path to the output feature class *_field: str, names of the fields in the input table wkid: int, well-known id of the coordinate system """ # create output feature class from pathlib import Path folder = str(Path(out_features).parent) name = str(Path(out_features).name) arcpy.management.CreateFeatureclass(folder, name, "POLYGON", spatial_reference=wkid) arcpy.management.AddField(out_features, "FID", "LONG") with arcpy.da.InsertCursor(out_features, ["SHAPE@", "FID"]) as i_cursor: with arcpy.da.SearchCursor(in_table, ["OID@", x_field, y_field, bearing_left_field, bearing_right_field, distance_field]) as s_cursor: # for each table row for oid, x, y, bearing_left, bearing_right, distance in s_cursor: # create a circle section poly = circle_section(x, y, bearing_left, bearing_right, distance, wkid) # write the polygon and the table row's objectid into the feature class i_cursor.insertRow([poly, oid])
create_view_sheds("table_name", "memory/polygon_name", "X", "Y", "left_bearing_field", "right_bearing_field", "distance_field", <wkid>)
The image below shows the polygons are created from the direction of the point feature to visualize the angle of the survey area on the map.
Article ID: 000028473
Get help from ArcGIS experts
Download the Esri Support App