3

I have a polygon shapefile (with 4000 records in it) that I want to group into different regions by doing a "select by attribute". I need to do this about 164 times because of the different selection ranges I use in the expression (eg nr >= 1000 AND nr <= 1119).

For each new selection I need to calculate the Fieldname(Region) to the name of the new region (again 164 times)

How can I achieve this in ModelBuilder?

3
  • btw Im totally new ni using modelbuilder and programming
    – user6014
    Commented Feb 20, 2012 at 9:20
  • So you have 164 unique expressions to calculate against?
    – artwork21
    Commented Feb 20, 2012 at 15:04
  • the 4000 records range from 1000 to 4026. I have to select values >=1000 and <=1119 and if this is true, then all these records goes into Region 1. Same calculation for Region 2 but values >=1120 and <=1159. and so on for region3 up to region 164. I also want to make sure that the Region field gets calculated at teh same time eg. if value >=1000 and <=1119, the "calculate field('Region')= 'Region1'. etc etc
    – user6014
    Commented Feb 20, 2012 at 15:40

1 Answer 1

6

You state you already know that you have 164 expressions to run, which would give you 164 regions, but each expression varies slightly. So you must have knowledge or a list of the ranges each region will be?

You could use Excel to create a column where each row contains the sql expression you intend to run in the select by attribute tool and save this off as a dbase file where the region number is implied by the row number.

If you are using ArcGIS 10 then you could use a for iterator to step through your dbase and using the field (which would be a string field) to be the expression for the select by attribute and the value to be the region number to assign to the selected fields

2
  • 1
    If you're going to use Excel, you might just as well reclassify the [nr] field right then and there! You can do it by setting up a sorted array of breakpoints and indexing into it using VLOOKUP (with the range option set to TRUE).
    – whuber
    Commented Feb 20, 2012 at 19:01
  • Thank you for the advise. Also thought to rather do it in Excel.
    – user6014
    Commented Feb 20, 2012 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.