python越来越慢_为什么我的算法越来越慢?

前提:我不是程序员!

我编写了一个Python代码,用arcgis9.2geoprocessor在DB字段上执行迭代。

该算法需要在超过两千条记录上迭代,其速度逐渐降低,直到每次迭代5/6分钟!

这是我的代码:# Import system modules

import sys, string, os, arcgisscripting

# Create the Geoprocessor object

gp = arcgisscripting.create()

# Set the necessary product code

gp.SetProduct("ArcEditor")

# Load required toolboxes...

gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")

gp.OverWriteOutput = "True"

# Global variables...

PP_ID_2012_dbf="C:\\...\\4Paths_PP_ID.dbf"

Paths_2012 = "C:\\...\\Paths_2012.shp"

# Search Cursor

src = gp.SearchCursor(PP_ID_2012_dbf)

row = src.Next()

src.Reset()

# While cycle

while row:

SQL_expr = row.GetValue("Query") # Query SQL

print row.GetValue("Query")

Selected_Path = "C:\\...\\Path_"+str(row.GetValue("PointPath_"))+".shp"

# Process: Select...

gp.Select_analysis(Paths_2012, Selected_Path, SQL_expr)

Paths_2012_Select_Simplify_shp="C:\\...\\Path_"+str(row.GetValue("PointPath_"))+"_Simplify.shp"

# Process: Simplify Lines...

gp.SimplifyLine_management(Selected_Path, Paths_2012_Select_Simplify_shp, "POINT_REMOVE", "20 Meters", "FLAG_ERRORS", "KEEP_COLLAPSED_POINTS", "CHECK")

del SQL_expr

del Selected_Path

del Paths_2012_select_Simplify_shp

row = src.Next()

怎么了?我认为这是一个缓存内存的问题,但我不能自己解决。

求你了,帮帮我!在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值