乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      使用UpdateCursor來根據(jù)一個字段值計算另外一個字段值

       昵稱QAb6ICvc 2013-01-31
       Howto: 使用UpdateCursor來根據(jù)一個字段值計算另外一個字段值

      文章編號: 35223

      軟件: ArcGIS - ArcEditor 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 9.2, 9.3, 9.3.1 ArcGIS - ArcView 9.2, 9.3, 9.3.1

      操作系統(tǒng): N/A


      摘要:

      示例腳本展示了如何通過使用UpdateCursor來根據(jù)一個字段中的值計算另外一個字段的值。

      有時候我們需要根據(jù)一個字段的值來設(shè)定另外一個字段的值,這可以通過使用UpdateCursor及條件語句來實現(xiàn)。

      內(nèi)容:

      思路:

      1. 創(chuàng)建geoprocessor對象。

      2. 輸入需要更新的要素類。

      3. 創(chuàng)建UpdateCursor對象。

      4. 逐行根據(jù)條件語句對指定字段賦值。

      # Import the standard modules and create the geoprocessor...
      import arcgisscripting, os, string, sys, time
      gp = arcgisscripting.create()

      # Set the overwrite to true...
      gp.overwriteoutput = 1

      # The file to be updated...
      fc = r"C:\Temp\testdata.shp"

      # Create the UpdateCursor Object
      cur = gp.updatecursor(fc)
      row = cur.next()

      while row:
      # Get the value of the field the calculation will be based on...
      field1 = str(row.getvalue("FIELD1"))

      # Conditional Statements
      # if the field1 = value1, set field2 to equal NewVal1, etc...
      if field1 == "Value1":
      row.FIELD2 = "NewVal1"
      cur.updaterow(row)
      row = cur.next()
      elif field1 == "Value2":
      row.FIELD2 = "NewVal2"
      cur.updaterow(row)
      row = cur.next()
      else:
      row.FIELD2 = "NewVal3"
      cur.updaterow(row)
      row = cur.next()

      del cur, row, gp

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多