Arcpy指向折线过度简化结果

时间:2016-04-28 18:07:47

标签: python gis polyline arcpy

我正在尝试将~4k gps点转换为折线。我最终想要缓冲点并识别路径覆盖。我得到的是一条不完整的线。有重复的点和重叠点,但我用这个数据集测试了下面的代码,它似乎运行fin

feature_info = [[[1, 2], [2, 4], [3, 7],[3, 7],[3, 7],[3, 7],[3, 7],[3, 7], [2, 4], [7, 2], [9, 5],[.5,0]]]

Points and polyline to connect points 当前代码

coordArray = arcpy.Array()
feature_info = []
newcoord = []
# Open a searchcursor
Input = '.../5PT175.shp'
rows = arcpy.SearchCursor(Input,  fields="Latitude; Longitude;Timestamp;Speed", sort_fields="Timestamp A")

# Iterate through the rows in the cursor and print out the
# state name, county and population of each.
for row in rows:
    position = [row.getValue("Longitude"),row.getValue("Latitude")]
    newcoord.append(position)
    coordArray.add(arcpy.Point(latitude,longitude))
newcoord = [newcoord]

# A list that will hold each of the Polyline objects
features = []

for feature in newcoord:
    # Create a Polyline object based on the array of points
    # Append to the list of Polyline objects
    features.append(
        arcpy.Polyline(
            arcpy.Array([arcpy.Point(*coords) for coords in feature])))

# Persist a copy of the Polyline objects using CopyFeatures
output = '.../polylines.shp'
arcpy.CopyFeatures_management(features, output)

我很乐意发布点文件,但我不确定如何在这个网站上发布。这是测试代码的片段

newcoord = [[[-119.286071777, 37.165851593],  [-119.287513733, 37.164966583],  [-119.287521362, 37.164966583],  [-119.287513733, 37.164966583],  [-119.287521362, 37.164966583],  [-119.287513733, 37.164966583],  [-119.287521362, 37.164958954],  [-119.28754425, 37.164936066],  [-119.28755188, 37.164897919],  [-119.287559509, 37.164890289],  [-119.287559509, 37.164890289],  [-119.287574768, 37.16488266],  [-119.287567139, 37.164878845],  [-119.287597656, 37.164810181],  [-119.287590027, 37.164775848],  [-119.287574768, 37.164779663],  [-119.287582397, 37.164787292],  [-119.287536621, 37.16481781],  [-119.287498474, 37.164867401],  [-119.287506104, 37.164875031],  [-119.287498474, 37.164875031],  [-119.287483215, 37.164867401],  [-119.287475586, 37.164878845],  [-119.287460327, 37.164890289],  [-119.287460327, 37.164905548],  [-119.287460327, 37.164897919],  [-119.287460327, 37.164909363],  [-119.287460327, 37.164909363],  [-119.287460327, 37.164905548],  [-119.287452698, 37.164901733],  [-119.287452698, 37.164901733],  [-119.287452698, 37.164901733],  [-119.287452698, 37.164901733],  [-119.287445068, 37.164905548],  [-119.287437439, 37.164905548],  [-119.287437439, 37.164909363],  [-119.28742981, 37.164905548],  [-119.28742981, 37.164897919],  [-119.28742981, 37.164890289],  [-119.28742981, 37.164886475],  [-119.28742218, 37.164886475],  [-119.28742218, 37.164886475],  [-119.28742218, 37.164886475],  [-119.28742218, 37.164905548],  [-119.287414551, 37.164920807],  [-119.287445068, 37.16488266],  [-119.287452698, 37.164901733],  [-119.287506104, 37.164863586],  [-119.287521362, 37.164829254],  [-119.287483215, 37.164833069],  [-119.287483215, 37.164829254],  [-119.287475586, 37.164821625],  [-119.287475586, 37.16481781],  [-119.287368774, 37.164878845],  [-119.287246704, 37.164955139],  [-119.287193298, 37.164936066],  [-119.28717804, 37.164970398],  [-119.28717804, 37.16500473],  [-119.28717804, 37.165008545],  [-119.28717804, 37.165008545],  [-119.28717804, 37.165000916],  [-119.28717804, 37.164993286],  [-119.287223816, 37.164958954],  [-119.287246704, 37.16493988],  [-119.287246704, 37.164936066],  [-119.287246704, 37.164936066],  [-119.287246704, 37.16493988],  [-119.287246704, 37.16494751],  [-119.287246704, 37.164955139],  [-119.287239075, 37.164970398],  [-119.287223816, 37.16500473]]]

1 个答案:

答案 0 :(得分:0)

瑞克,

您是否尝试过Points to Line ESRI工具?