![Arcgis100之后版本坐標(biāo)值轉(zhuǎn)換成shp圖層教程_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/d203ffd2-f2c8-4cf7-8d16-34a9bd0e7390/d203ffd2-f2c8-4cf7-8d16-34a9bd0e73901.gif)
![Arcgis100之后版本坐標(biāo)值轉(zhuǎn)換成shp圖層教程_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/d203ffd2-f2c8-4cf7-8d16-34a9bd0e7390/d203ffd2-f2c8-4cf7-8d16-34a9bd0e73902.gif)
![Arcgis100之后版本坐標(biāo)值轉(zhuǎn)換成shp圖層教程_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/d203ffd2-f2c8-4cf7-8d16-34a9bd0e7390/d203ffd2-f2c8-4cf7-8d16-34a9bd0e73903.gif)
![Arcgis100之后版本坐標(biāo)值轉(zhuǎn)換成shp圖層教程_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/d203ffd2-f2c8-4cf7-8d16-34a9bd0e7390/d203ffd2-f2c8-4cf7-8d16-34a9bd0e73904.gif)
![Arcgis100之后版本坐標(biāo)值轉(zhuǎn)換成shp圖層教程_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/d203ffd2-f2c8-4cf7-8d16-34a9bd0e7390/d203ffd2-f2c8-4cf7-8d16-34a9bd0e73905.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、通過(guò)坐標(biāo)數(shù)值生成點(diǎn)線面的shp圖層Arcgis10.0之后版本雖然交9.3增加了很多功能,但是卻不知何故少了一些常用的功能。本問(wèn)主要就比較常用通過(guò)坐標(biāo)數(shù)值生成點(diǎn)線面的shp圖層做簡(jiǎn)單介紹。一、前期準(zhǔn)備1.將附件CreateFeaturesFromTextFile文件復(fù)制到任何一個(gè)固定的位置。2.打開(kāi)Arcgis,新建toolbox3.按圖新建腳本工具 C:Program FilesArcGISDesktop10.1ArcToolboxStylesheetsgeoprocessing_help.xsl4.點(diǎn)擊下一步,Script File選擇剛才那個(gè)腳本文件“CreateFeaturesFrom
2、TextFile”5.設(shè)置參數(shù)其中,“坐標(biāo)值規(guī)定“中的Default的值為12345678.12345“輸出shp文件”中的Direction改為output“坐標(biāo)系統(tǒng)“的type改為optional6.點(diǎn)擊finished二、制作帶有坐標(biāo)的文本文件。1.這個(gè)文件第一行以d,x,m開(kāi)頭,分別表示點(diǎn)線面。2.接下幾行是坐標(biāo)值,以“編號(hào)(編號(hào)從0開(kāi)始) X坐標(biāo) Y坐標(biāo)”例如:0 40545654.256 532145697.3253.另起行以end結(jié)束。保存成txt格式的文件。三、生產(chǎn)shp圖層1.打開(kāi)剛才那個(gè)制作好的腳本工具CreateFeaturesFromTextFile2. 按照提示操作,
3、坐標(biāo)系統(tǒng)可以不填3.點(diǎn)擊Ok。完成注意事項(xiàng):編寫(xiě)的txt文件的坐標(biāo)必須按照順序編寫(xiě),否則圖形會(huì)出現(xiàn)紊亂(點(diǎn)文件除外)。將一下文本粘貼到txt中,并保存成.py的文件。'''- Tool Name: CreateFeaturesFromTextFile Source Name: CreateFeaturesFromTextFile.py Version: ArcGIS 9.1 Author: Environmental Systems Research Institute Inc. Required Argumuments: An Input Text File cont
4、aining feature coordinates An Input Character designating the decimal separator used in the text file. An output feature class Optional Arguments: A spatial reference can be specified. This will be the spatial reference of the output fc. Description: Reads a text file with feature coordinates and cr
5、eates a feature class from the coordinates.-'''import string, os, sys, locale, arcgisscriptinggp = arcgisscripting.create()gp.overwriteoutput = 1msgErrorTooFewParams = "Not enough parameters provided."msgUnknownDataType = " is not a valid datatype. Datatype must be point,
6、multipoint, polyline or polygon."msgErrorCreatingPoint = "Error creating point %s on feature %s"# sets all the point propertiesdef createPoint(point, geometry): try: point.id = geometry0 point.x = geometry1 point.y = geometry2 # When empty values are written out from pyWriteGeomToText
7、File, they come as 1.#QNAN # Additionally, the user need not supply these values, so if they aren't in the list don't add them if len(geometry) > 3: if geometry3.lower().find("nan") = -1: point.z = geometry3 if len(geometry) > 4: if geometry4.lower().find("nan") = -
8、1: point.m = geometry4 return point except: raise Exception, msgErrorCreatingPointtry: # get the provided parameters inputTxtFile = open(gp.getparameterastext(0) fileSepChar = gp.getparameterastext(1) outputFC = gp.getparameterastext(2) # spatial reference is optional outputSR = gp.getparameterastex
9、t(3) # make sure the text type specified in the text file is valid. inDataT = inputTxtFile.readline().strip().lower() d = 'd':'point','ml':'multipoint','x':'polyline','m':'polygon' inDataType = dinDataT dataTypes = "point", &q
10、uot;multipoint", "polyline", "polygon" if inDataType.lower() not in dataTypes: msgUnknownDataType = "%s%s" % (inDataType, msgUnknownDataType) raise Exception, msgUnknownDataType # create the new featureclass gp.toolbox = "management" gp.CreateFeatureclass
11、(outputFC)0, (outputFC)1, inDataType, "#", "ENABLED", "ENABLED", outputSR) # create a new field to assure the id of each feature is preserved. idfield = "File_ID" gp.addfield(outputFC, idfield, "LONG") # get some information about the new featureclas
12、s for later use. outDesc = gp.describe(outputFC) shapefield = outDesc.ShapeFieldName # create the cursor and objects necessary for the geometry creation rows = gp.insertcursor(outputFC) pnt = gp.createobject("point") pntarray = gp.createobject("Array") partarray = gp.createobject
13、("Array") locale.setlocale(locale.LC_ALL, '') sepchar = locale.localeconv()'decimal_point' # loop through the text file. featid = 0 lineno = 1 for line in inputTxtFile.readlines(): lineno += 1 # create an array from each line in the input text file values = line.replace(&qu
14、ot;n", "").replace("r", "").replace(fileSepChar, sepchar).split(" ") # for a point feature class simply populate a point object and insert it. if inDataType = "point" and values0.lower() != "end": row = rows.newrow() pnt = createPoint(
15、pnt, values) row.SetValue(shapefield, pnt) row.SetValue(idfield, int(values0) rows.insertrow(row) # for a multipoint the text file is organized a bit differently. Groups of points must be inserted at the same time. elif inDataType = "multipoint": if len(values) > 2: pnt = createPoint(pn
16、t, values) pntarray.add(pnt) elif (len(values) = 2 and lineno != 2) or values0.lower() = "end": row = rows.newrow() row.SetValue(shapefield, pntarray) # store the feature id just in case there is an error. helps track down the offending line in the input text file. if values0.lower() != &q
17、uot;end": row.SetValue(idfield, featid) featid = int(values0) else: row.SetValue(idfield, featid) rows.insertrow(row) pntarray.removeall() elif (len(values) = 2 and lineno = 2): featid = int(values0) # for polygons and lines. polygons have a bit of logic for interior rings (donuts). # lines use
18、 the same logic as polygons (except for the interior rings) elif inDataType = "polygon" or inDataType = "polyline": #takes care of #adds the point array to the part array and then part array to the feature if (len(values) = 2 and float(values1) = 0 and lineno != 2) or values0.low
19、er() = "end": partarray.add(pntarray) row = rows.newrow() row.SetValue(shapefield, partarray) # store the feature id just in case there is an error. helps track down the offending line in the input text file. if values0.lower() != "end": row.SetValue(idfield, featid) featid = int
20、(values0) else: row.SetValue(idfield, featid) rows.insertrow(row) partarray.removeall() pntarray.removeall() #adds parts and/or interior rings to the part array elif (len(values) = 2 and float(values1) > 0) or values0.lower() = "interiorring": partarray.add(pntarray) pntarray.removeall() #add points to the point array elif len(values) > 2: pnt = createPoint(pnt, values) pntarray.add(pnt) elif (len(values) = 2
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 糧庫(kù)員工年終工作總結(jié)
- 員工感恩公司演講稿范文(7篇)
- 2025年軟件銷售中介服務(wù)合同樣本
- 2025年大型購(gòu)物中心加盟合同模板
- 2025年防腐施工及后續(xù)保修合同示范文本
- 區(qū)域白酒代理業(yè)務(wù)2025年合作協(xié)議書(shū)
- 閥門產(chǎn)品購(gòu)銷申請(qǐng)協(xié)議2025
- 2025年個(gè)人貸款購(gòu)房合同
- 2025年網(wǎng)絡(luò)及通信協(xié)議處理軟件項(xiàng)目規(guī)劃申請(qǐng)報(bào)告模范
- 2025年特種用途鋼絲及鋼絲繩項(xiàng)目規(guī)劃申請(qǐng)報(bào)告
- 2025年寬帶研究分析報(bào)告
- 建筑與市政工程第三方質(zhì)量安全巡查方案
- 多元化票務(wù)系統(tǒng)設(shè)計(jì)-深度研究
- 二零二五版財(cái)務(wù)顧問(wèn)保密與工作內(nèi)容協(xié)議3篇
- 2025-2030年中國(guó)干混砂漿行業(yè)運(yùn)行狀況及發(fā)展趨勢(shì)預(yù)測(cè)報(bào)告
- 2024年菏澤職業(yè)學(xué)院高職單招語(yǔ)文歷年參考題庫(kù)含答案解析
- GB/T 22180-2024速凍裹衣魚(yú)
- 2025江蘇鹽城市交通投資建設(shè)控股集團(tuán)限公司招聘19人高頻重點(diǎn)提升(共500題)附帶答案詳解
- 2024托管班二人合伙的協(xié)議書(shū)
- 《輸電線路金具識(shí)別》課件
- 基于PLC的豬場(chǎng)智能液態(tài)飼喂系統(tǒng)的設(shè)計(jì)與研究
評(píng)論
0/150
提交評(píng)論