Quantcast
Channel: Forum SIG - Systèmes d'Information Géographique et Géomatique
Viewing all articles
Browse latest Browse all 8030

[ArcGIS 10.x] CreateTable_management python

$
0
0
bonjour,
je veux créer une table tableTest contient des enregistrement d'une autre table selon un traitement malheureusement la table est créé mais elle est vide
Code:

import arcpy
 
from arcpy import env


# Set workspace
env.workspace = "C:/Users/admin/Desktop/pfe/bdl.mdb"
# Set local variables
out_path = "C:/Users/admin/Desktop/pfe"
out_name = "tableTest.dbf"


config_keyword = ""


# Execute CreateTable
arcpy.CreateTable_management(out_path, out_name, config_keyword)
arcpy.AddField_management(out_name, "id", "SHORT")
arcpy.AddField_management(out_name, "aret", "SHORT")
arcpy.AddField_management(out_name, "long", "DOUBLE")
arcpy.AddField_management(out_name, "checkD", "SHORT")
tableSIF_D="tableTest.dbf"
#Cursor to add value in the tableTest
D=150
tableTest=arcpy.InsertCursor(tableTest)
origin = arcpy.SearchCursor('C:/Users/admin/Desktop/pfe/bdl.mdb/table')
l=0


for i in origin:   
    if(i.getValue("is_egal") == 1):
            I = i.getValue("id_n1")
            F = i.getValue("id_n2")
            l = l + i.getValue("Length")
            if(D > l):
                  t_row = tableTest.newRow()
                  t_row.id = i.getValue("id_n1")
                  t_row.aret= i.getValue("ID")
                  t_row.long = l
                  t_row.checkD = 0
                 
                  tableTest.insertRow(t_row)
origin.next                 
del i, origin


Viewing all articles
Browse latest Browse all 8030

Trending Articles