-
大小: 3KB文件類型: .py金幣: 1下載: 0 次發布日期: 2021-01-02
- 語言: Python
- 標簽: arcgis10.3??python??批量??shapefile??
資源簡介
在arcgis10.3中,python實現批量txt文件生成點要素類文件。ps:嘗試在8g內存的電腦上運行會出現runtime error,在32g內存電腦上運行沒有問題
代碼片段和文件信息
#coding:utf-8
#如果電腦是8g內存可能會出現runtime?error的問題,放在32g內存的電腦里運行是沒問題的
#拷貝到arcgis里運行時建議去掉所有中文
import?arcpy
import?os
from?arcpy?import?env
env.workspace?=?‘E:/data/‘?????????????????????????????????????????????????????????????????????????????????#存放txt的文件夾地址
filepath?=?env.workspace
resultpath?=?“F:/result/“??????????????????????????????????????????????????????????????????????????????????#存儲.shp文件的地址
filelist?=?os.listdir(filepath)
for?i?in?range(len(filelist)):??????????????????????????????????????????????????????????????????????????????#txt文件數量
????readfile=open(filepath+‘/‘+filelist[i])?????????????????????????????????????????????????????????????????#逐一讀取txt文件
????newfc=arcpy.CreateFeatureclass_management(resultpath?filelist[i].split(‘.‘)[0]+‘.shp‘?‘POINT‘)????????#創建點shapef
評論
共有 條評論