How to populate a field of the polygon feature's attribute table based on selection

409
5
02-15-2013 01:34 AM
SharifulIslam
New Contributor III
I have parcel maps, where each polygon represents for parcel.These polygons are made by "Feature to polygon" of  polylines made from arc scan auto vectorization of a  tiff files. These tiffs contains parcel IDs in the form of several set of consecutive numbers.Now i want to populate a field in the attribute table of the polygon feature named "Parcel ID" based on the my selection serial  in  editing session. In a nutshell what i want is to select polygon based on their "Parcel Ids", scribed on tiffs,serial (e.g.555,556,557,558) and the apply a field calculator script to populate with consecutive numbers(555-558) by python script,but problem is when i select polygons based on the Parcel ID serial they are not select in the attribute table accordingly rather in ascending order of FIDs/OIDs. I am to work on many of such tiffs, what can i do.



Thanks in advance...
Tags (2)
0 Kudos
5 Replies
AnthonyGiles
Frequent Contributor
Shariful,

If you select the parcels that you want to change the attributes for, then right click on the field heading of the attribute you want to change in the attribute table and select calculate values this will only change the value for the parcels you have selected.

Hope that is what you are after,

Regards

Anthony
0 Kudos
SharifulIslam
New Contributor III
Thanks Anthony, What do you mean by calculate value, would you clear a bit. I want to populate "Parcel ID" by my selection order of polygons  in editing session; i am in arc map 10.
0 Kudos
AnthonyGiles
Frequent Contributor
Shariful,

I don't know of a way to auto increment a number by the order that you select features, you can autonumber a selection of features, but the numbering will be done by the order they are in the table. The script to do this is below. To calculate values, right click the column heading and select calculate values from the on text menu, see:

http://www.esri.com/news/arcuser/0405/files/fieldcalc_1.pdf

make sure to set the parser language to Python. Click the advanced check box, in the code block section, you want to paste the sample:

rec=0
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
  rec = pStart
else:
  rec = rec + pInterval
return rec

Then in the text box at the bottom of the field calculator where it says "YOUR_FIELDNAME=", simply type in the name of the function, which in this case is AutoIncrement().

Regards

Anthony
0 Kudos
SharifulIslam
New Contributor III
Thanks, But what I need is only the selection order,because i have many consecutive number to be populated with (in the field ). I want this done automatically based on selection. Is there any programming hints for C# Please guide; I am really type of bored doing this manually.



Thanks again...
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thanks, But what I need is only the selection order,because i have many consecutive number to be populated with (in the field ). I want this done automatically based on selection. Is there any programming hints for C# Please guide; I am really type of bored doing this manually.



Thanks again...


I do programming in VB.Net and what you want is not possible in any language.  Nothing keeps track of a selection order as you have described it.  Once a second item is selected a cursor will read them in the order they were created in the table, regardless of the order you selected them, just like the field calculator.  The only way around that is with another field providing a sort order, but if you had that it probably would be in the field you are trying to populate.  At best you could select one item, press a button or hot key to assign the next unused sequence number and then deselect it and select another.  Only slightly better than typing the values in yourself, but perhaps a little easier.  Your database design or workflow is poor if it is truly dependent on this type of editing, because as you have seen it requires intensive manual intervention to work.

In my jurisdiction this would not work well, because the next sequence number for a parcel is dependent on the book and page the parcel falls on, which may not be apparent to the program without a fairr amount of issues to overcome.  QC generally is manual in such cases.
0 Kudos