Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a polygn layer and each polygon has the MEAN elevation as an attribute. I want to write a python script to select each polygon and compare its elevation with its neighbouring polygons and store the result in a table as (From-To) where if a surrounded polygon has lower elevation, I add to the table and if not, I escape it....and loop for each polygon.

share|improve this question
5  
Which software? –  Nathan W Feb 8 '13 at 10:23
    
I am using ArcGIS 10.1 –  Yaya Feb 11 '13 at 12:34

1 Answer 1

The answer on your question is in my view independent of what scripting language or programm you use.

For your question it is of importance that you define the relation between a polygon and bordering polygons. I would recommend searching for a function that is able to select surrounding polygons. If you cant find such function I would create small buffers and then intersect these buffers with surrounding polygons. The intersections can be used to select the surrounding polygons. Then you can extract all the height values of the surrounding polygons. After extraction you can do your calculation/selection.

In a script it would basically go like:

  • create dataframe
  • for loop: for each polygon in my dataset
  • Selection: select polygons bordering a polygon
  • Extraction: extract elevation of each bordering polygon
  • calculation: calculation with all elevation values
  • fill dataframe: add a new row in your dataframe starting with the central polygon followed by the results of your calculation

It is not exactly clear to me what you want to calculate in the end. So that you will have to figure out or ask more explicit. For exact scripting questions you will have to come with a piece of code I can see and reflect on. It is unlikely that somebody here is going to make the entire script for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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