Top.Mail.Ru
Python
? ?
LiveJournal for python.
View:Personal Journal.
View:Friends.
View:Calendar.
Missed some entries? Then simply jump to the previous day or the next day.

Wednesday, December 6th, 2006

Subject:ArcMap script help
Time:11:24 am.
I'm trying to get a rather simple program to work, but I'm having difficulty with MakeTableView and GP.SearchCursor working correctly together. It may just be the way I'm trying to test the script (i.e. not making my "selection" correctly in ArcMap).

I have a simple script to calculate the sum of a field for selected features in a layer, sum the field for all values of that field for the layer, and then find the proportion. I'm making my selection using the "select by attributes" option on the table in ArcMap. However, when the program runs, it gives me the sum for the entire table for both the "selectedSum" and "totalSum". This leads me to believe I'm not selecting things the right way for the distinction between GP.SearchCursor and MakeTableView. I really don't understand how they work well, since I can't find good documentation to save my life (have been told that there's stuff in ESRI's online documentation, but none of it is clear to me at all). It's possible I'm missing something simple but obvious in my code, but I'm starting to think I'm not testing it correctly.

Any ideas? It's really quite simple, which is why I'm frustrated. I'm just very very new to Python scripting, and how it interacts with ArcMap. Thanks for any help/guidance.

EDIT: At this point, I'm 90% sure that the issue is with how I'm trying to test the script (how to make the selection), rather than my code. Got a classmate's code, and got the exact same result when running it (and it appears to effectively be the same code).

My code is hereCollapse )
Comments: Add Your Own.

LiveJournal for python.

View:User Info.
View:Friends.
View:Calendar.
View:Memories.
Missed some entries? Then simply jump to the previous day or the next day.

Image