I have a lat and long starting point and want to create a polyline with vertices at distances and bearings sequentially from one to another

1372
6
01-19-2018 05:14 PM
KarenYoungblood2
New Contributor

I can't use the Bearing Distance to Line tool because I only have one point with a known location. Each additional point will be created sequentially by taking the bearing and distance from the last one. There has to be a way to do this in ArcMap 10.5 right?

0 Kudos
6 Replies
DanPatterson_Retired
MVP Esteemed Contributor

enter a traverse... and create a traverse... rings a bell

JoshuaBixby
MVP Esteemed Contributor

If you want to script this, the pointFromAngleAndDistance method of the ArcPy Geometry—Help | ArcGIS Desktop classes can be used.

XanderBakker
Esri Esteemed Contributor

Depending on the amount of data you have you should either choose doing this manually in an edit session as Dan suggests of doing this with some python. To give you some additional help on using the Python option see the script below:

def main():
    import random
    import arcpy

    # settings input and output data
    tbl = r'C:\GeoNet\BearingDistance\data.gdb\BrearingDistanceData'
    fld_bear = 'Bearing'
    fld_dist = 'Distance'
    fc_out = r'C:\GeoNet\BearingDistance\data.gdb\BrearingDistanceLine'

    # start point and projected coordinate system
    start_x = -8413550
    start_y = 696897
    sr = arcpy.SpatialReference(3857)

    # create start point
    pntg = arcpy.PointGeometry(arcpy.Point(start_x, start_y), sr)

    # create sequential points
    points = [pntg.firstPoint]
    pntg_prev = pntg
    with arcpy.da.SearchCursor(tbl, (fld_bear, fld_dist)) as curs:
        for row in curs:
            angle = row[0]
            distance = row[1]
            pntg_new = pntg_prev.pointFromAngleAndDistance(angle, distance)
            pntg_prev = pntg_new
            points.append(pntg_new.firstPoint)

    # create polyline and store result
    polyline = arcpy.Polyline(arcpy.Array(points), sr)
    arcpy.CopyFeatures_management([polyline], fc_out)

if __name__ == '__main__':
    main()

It takes a table with two fields (Bearing and Distance, see settings on line 7 and 8) and an initial point (see lines 12 and 13) and traces a line. See the result below:

To create the table data I used a random function. See code below:

def main():
    import random
    import arcpy
    tbl = r'C:\GeoNet\BearingDistance\data.gdb\BrearingDistanceData'
    fld_bear = 'Bearing'
    fld_dist = 'Distance'

    with arcpy.da.InsertCursor(tbl, (fld_bear, fld_dist)) as curs:
        for i in range(100):
            sector = divmod(i, 25)[0] # 0 to 3
            angle = random.randrange(sector * 90, (sector+1)*90)
            distance = random.randrange(1000, 1050+i*50)
            print i, sector, angle, distance
            curs.insertRow((angle, distance, ))

if __name__ == '__main__':
    main()

If you have any questions, just post them back here.

DanPatterson_Retired
MVP Esteemed Contributor

A traverse lesson.... might also do it

RandyBurton
MVP Regular Contributor

Sounds a bit like COGO (Coordinate Geometry).  There is a tool available with Standard or Advanced license. An overview of COGO

When surveyors or civil engineers need to record the location of human-made features, such as land parcels, road centerlines, utility easements containing transmission lines, and oil and gas leases, they typically provide the results on a survey plan that describes the location of features relative to each other.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor
0 Kudos