get excel fields into GIS dataset att table

This is the place for queries that don't fit in any of the other categories.

get excel fields into GIS dataset att table

Postby kimtheis » Thu Aug 08, 2013 2:37 am

Hi,
i have been struggling with this one for a couple of weeks and I feel its time to ask for help. I have data that I collected for my MS thesis and I want to put it into a GIS. First, I need to create the fields in an attribute table. I have some code from my programming class but I cant get it to work properly. Ive error checked and there is at least one problem with the AddField portion of my code. I went into ESRI's help and sought out the proper data requirements but when I try to use them, I have no luck. The ESRI page states you need Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View. I tried using a shapefile and a raster but they are "not supported". I have to assume because of the dataset needs.

I have no idea how I am going to make this work. I know this code format works because I used it in lab. I just want to make it work for my project/thesis....any suggestions? Here is my code. I was able to create a field called Uniq_ID, but I want my fields (40 or so). Do I just add them where the Uniq_ID is at? What about the rest of the code? My Geo_Proc_ is a spreadsheet that contains 1/3 of the fields I want to add. Do you think it should be where it is? It doesnt seem like it did anything but sit there :)

Again, any thoughts or suggestions would be helpful (Ive been working since July 20th or so)

Code: Select all
#Purpose: To add my table to a table in ArcGIS
#Syntax: AddField_management (in_table, field_name, field_type, {field_precision},
#{field_scale}, {field_length}, {field_alias}, {field_is_nullable}, {field_is_required}, {field_domain})

import arcpy
arcpy.env.workspace = "C:\\Users\\Kim\\Documents\\Lava_Beds_GIS\\KLavaBedsK\\LavaBeds.mdb"
arcpy.AddField_management("norcaldem", "Uniq_ID", "LONG")
cur = arcpy.UpdateCursor("Geo_Proc_") #create Update cursor for LABE_Boundary, which is where I want the new attributes to go to
for row in cur:
    row.Uniq_ID = row.id + row.place_name
    cur.updateRow(row)
del cur, row
kimtheis
 
Posts: 1
Joined: Thu Aug 08, 2013 1:37 am

Return to General Coding Help

Who is online

Users browsing this forum: Mekire and 8 guests