How can I attribute individual polygons in a shapefile with row and column numbers so that each polygon will have its own unique combination of column and row values. Examples of shapefile types could be a simple fishnet grid, or something less regular like the counties in a state.
Right now my attribute table looks something like this:
Polygon |
---|
A |
B |
C |
I'd like the resulting attribute table to look something like this:
Polygon | Column | Row |
---|---|---|
A | 1 | 1 |
B | 1 | 2 |
C | 2 | 1 |
D | 2 | 2 |
E | 3 | 1 |
*Edited to change "label" to "attribute"
[POLYGON]+[COLUMN]+[ROW]
or
[POLYGON]+"-"+[COLUMN]+"-"+[ROW]
Something like that?
Thanks. I had actually meant attributing instead of labeling. But this was helpful in labeling my example image in my reply to Joshua Bixby.
I'm not sure I understand what you want to happen in the case of irregular polygons (like states). Can you provide a picture?
edit: based on the following comments, you may also want to provide the starting attribute table. I think most are assuming you already have the values for "Column" and "Row" populated, but I'm guessing that's your real problem.
Thanks. Good point.
A couple of questions:
For the irregular shapes you talk about, can you provide a rough illustration of what you see the result looking like?
You're right, I meant attributing. Thanks.
I'm trying to input data into a modeling program that requires shapefiles to have column and row values. But it doesn't read the data attached to these shapefiles, so the data needs to be input as a .csv file with matching column and row values, if that makes sense. The program provided some sample data, including a shapefile with counties (attached picture). It seems that every county has the same column value (26, highlighted in yellow), and it is the row value that is unique for each county.
I'm just not sure how to go about attributing column and row values to a shapefile like this or to a regular grid shaped shapefile.
In a former job, I worked extensively with state and county data from across the country. As soon as I saw the labels in your image, I knew what the number represent. I am not sure why they are labeled/called "rows" and "columns" in your data, but the data are FIPS/ANSI codes for States and County and County Equivalents (See: American National Standards Institute (ANSI) Codes - Geography - U.S. Census Bureau). The ANSI code for Michigan is 26, and the other numbers you see are the ANSI codes for the individual counties or county equivalents. If you are working with data from other states, you don't have to figure out a scheme for numbering, just use the ANSI codes that already exist.
If you are working with different irregular shaped data, then you would need to come up with some logic for ordering them like Dan points out.
Oh interesting. I'll look into that. Thanks.
What about attributing row and column values to a simple grid polygon? I need to do that too for this program.
It seems like row and column are somewhat arbitrary (i.e. the concept of "grid" is unnecessary, as in, polygons in the same "row" don't have to be at the same approximate Y value, and "columns" don't have to be at the same X value). If that is the case, then you can think of column as a grouping variable (e.g. all the polygons in the same state would get the same value, perhaps the state FID or ANSI or any other unique attribute, via Spatial Join) and then you can increment (there are many example on GeoNet) the value for row to make a unique combination.