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