row[leftI] = row[lExiI]
                row[statusI] = 'E'
                if isEmpty(row[roadNotesI]):
                    row[roadNotesI] = row[slNotesI][:50]
            if not isEmpty(row[rExiI]):
                row[rightI] = row[rExiI]
                row[statusI] = 'E'
                if isEmpty(row[roadNotesI]):
                    row[roadNotesI] = row[slNotesI][:50]

            cursor.updateRow(row)


if __name__ == '__main__':
    dataDirectory = r'.\data'
    Configs.setupWorkspace(dataDirectory)
    totalTime = time()

    # User provided feature classes.
    fullSgidRoads = Feature(
        r'Database Connections\Connection to utrans.agrc.utah.gov.sde\UTRANS.TRANSADMIN.Centerlines_Edit',
        'UTRANS.TRANSADMIN.StatewideStreets')
    bikeLanes = Feature(Configs.dataGdb, 'SLCountyBikeUpdate')
    distFromBikeLanes = 12  # distance to limit the road layer. Chosen after exploratory analysis.
    # Select road within a distance from bike lanes.
    subsetLayer = 'roadsCloseToBikeLanes'
    selectTime = time()
    arcpy.MakeFeatureLayer_management(fullSgidRoads.path, subsetLayer)
    arcpy.SelectLayerByLocation_management(subsetLayer, 'WITHIN_A_DISTANCE',
                                           bikeLanes.path, distFromBikeLanes)
    print 'Created subset of SGID roads: {}'.format(
Пример #2
0
    joinNearTime = time()
    nearPointsAndBikelanes(triPoint, bikeLanes, distFromBikeLanes)
    print 'Joined bikeLane fields to road points: {}'.format(
        round(time() - joinNearTime, 3))

    coverageTime = time()
    roadCoverageTable = createBikeLaneRoadCoverage(triPoint)
    print 'Created line coverage table: {}'.format(
        round(time() - coverageTime, 3))

    return roadCoverageTable


if __name__ == '__main__':
    totalTime = time()
    Configs.setupWorkspace(r'C:\GisWork\LineCoverage')
    global outputWorkspace
    global tempWorkspace
    global dataGdb
    print 'Run {}'.format(Configs.uniqueRunNum)
    # Workspaces
    # dataDirectory = r'C:\GisWork\LineCoverage'
    # dataGdb = os.path.join(dataDirectory, 'SourceData.gdb')
    # outputWorkspace = os.path.join(dataDirectory, 'OutputResults.gdb')
    # # Create a unique temp workspace for this run
    # tempWorkspace = os.path.join(Configs.dataDirectory, 'temp')
    # arcpy.CreateFileGDB_management(tempWorkspace,
    #                                'run_' + Configs.uniqueRunNum)
    # tempWorkspace = os.path.join(tempWorkspace, 'run_' + Configs.uniqueRunNum + '.gdb')
    # User provided feature classes.
    fullSgidRoads = Feature(Configs.dataGdb, 'Emery_roads')