2

I have two shapefiles, Country and Blocks. I need to run a very basic selection to find out what blocks intersect the country shapes. But, the country shapefile has 250+ countries and I need to do this for each row. The output is a list (ideally a .txt file) of one of the attributes of the block shapefile. I'm trying to automate this so I don't have to query each country then run the intersection manually. I'd like to run a Python script or make a model builder, but I don't know how to automate going from one row to the next.

  • 1
    You should look into Iterate Feature Selection. Welcome to GIS.SE! – Paul Sep 9 '13 at 20:52
  • Thanks Paul, I was able to reas about it but I can;t find it in the tool box. Any help on finding it? – user21849 Sep 9 '13 at 23:05
  • It's a model only tool; hence, it can only be found in model builder. – Paul Sep 10 '13 at 0:32
1

Why not do an intersect or identity and then use either frequency or summary statistics to sort the results?

Intersect / Identity will join the tables so values from both shapefiles will be accessible and then Frequency / Summary Statistics to reduce the results into just the unique combinations of countries and blocks. Output is a table which can be exported to CSV.

I have also done similar using a search cursor and then get the object id's, make a layer using a query (ObjectID = value) to isolate just the single block and then select layer by location, get count... just remember to delete the layer each time you've finished with it.

Either method will produce a result it just depends on what you want to do with the block/country combination and if you have access to INFO/Advanced level of license.

| improve this answer | |
  • +1; the OP appears to be a beginner with ModelBuilder/Python, so this is the way to go. No need to complicate things when running two simple tools will do. – Cindy Jayakumar Sep 11 '13 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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