AHP for ArcGIS 10.x using Python

When it comes to site selection problems or suitability models, the spatial Multi-Criteria Analysis (Weighted Overlay) is the most commonly used method. It’s easy, simple and popular. However, if it’s your first time to come across this method, it’s highly recommended to have a look at this link.

After defining the problem you want to solve, the next 4-steps are followed to perform this method.

  1. Determine significant layers.
  2. Reclassify the layers.
  3. Weight the input layers.
  4. Sum up the weighted layers

My concern was always about how I can assign a weight to each layer in a kind of scientific way. However, Analytic Hierarchy Process (AHP) sorted it out. Wiki defines it as “A structured technique for organizing and analyzing complex decisions, based on mathematics and psychology. It was developed by Thomas L. Saaty in the 1970s and has been extensively studied and refined since then”.

The main concept of AHP is to pair-wise compare all criteria. A value of 1 expresses “equal importance” and a value of 9 is given for those factors having an “extreme importance” over another factor in a comparison matrix.

To get a full description of this method, I do recommend these two videos which illustrate this method in a decent way.

Well, I found a tool that integrates the AHP method within ArcGIS Environment, but, unfortunately, it is compatible with ArcGIS 9.x only!. Therefore, I said why I don’t integrate these calculations within ArcGIS 10.x (tested on 10.2). Python scripting and ArcPy are used.

  1. Download the AHPforArcGIS10.x file and extract it.
  2. Right click on “ ArcToolbox”, click “add Toolbox”
  3.  Add the “AHP” toolbox (Fig.1)

    Fig1
    Fig1
  4. Double click on the (AHPstep1) script tool. This tool is developed to create an emptyAHP matrix that should be filled by the user. The tool is designed to identify all raster layers in the TOC. However, any vector layers will be ignored (Fig.2)
    Fig2
    Fig2

    In this example I have 5 layers in the TOC, the first two are vector layers and the rest are raster layers(fig.3).

    Fig3
    Fig3
  5. Choose the “File Geodatabase” that you want to save the matrix in.
  6. Choose a name for that comparison matrix.
  7. An empty matrix is generated in the “file Geodatabase” (as illustrated in the figure, the names of the layers are automatically assigned to the matrix).
  8. Add the table (matrix) to theArcMap and fill it (you can add /remove any desired field/row) (Fig.4)

    Fig4
    Fig4
  9. Double click on the (AHP step2) script tool. This tool is designed to analyse the comparison matrix and to generate the consistency index (CI) as well as consistency ratio (CR).
  10. Add the filled matrix (Fig.5)

    Fig5
    Fig5
  11. Another table will be added in the same filegeodatabase with a suffix (CI), refereeing to Consistency Index (Fig.6)

    Fig6
    Fig6
  12. The generated table lists the weights of each layer, consistency index (CI), consistency ratio (CR) and average consistency index (RI) (Fig.7)

    Fig7
    Fig7

If (CR) exceeds a value of 1, a message states “The comparison matrix should be improved.” appears in the “Notes” field, while a message states “The matrix is considered to be consistent enough “appears if the CR is less than the value of 1.

Note: the Maximum number of raster layers is 15 while the minimum number is 2. Otherwise, an error message appears.

Feel free to download the AHPforArcGIS10.x tool (with Python scripts).

Your comments are more than welcome.

5 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

11 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
MGM
MGM
6 years ago

Great to see this post. Can anyone tell, what is the next step? I mean, how to use this matrix with weighted values in ArcGIS to obtain final suitability map?

Mohammed Habboub
Habboub
6 years ago
Reply to  MGM

Yes, sure..

ArcGIS “Weighted sum” tool could be used.

Essentially, it multiplies each pixel of a layer by its generated weight. Then all the weighted layers are summed together.

Recalling my example above, the final suitability map = “Third layer” * 0.38 + “Fourth Layer” * 0.3 + “Fifth layer” *0.32.

The “raster calculator” tool is another option.

For more information, please check this page

http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000rr000000

and these nice videos:

Part1: https://www.youtube.com/watch?v=Gb4wnXWR_Bs

Part2: https://www.youtube.com/watch?v=uT2e_3kB2iY

Part3: https://www.youtube.com/watch?v=UC6M3IdCgLs

and let me know if you need any further help

MGM
MGM
6 years ago
Reply to  Habboub

Thanks Haboub!

Samuel Fernández
Samuel Fernández
6 years ago

Thanks a lot! This tool is too much useful. Thanks for sharing!

Mohammed Habboub
Habboub
6 years ago

Welcome, Samuel.
Happy to hear that 🙂

Shashi Bhattarai
Shashi Bhattarai
6 years ago

Thanks for sharing this useful information. I have further shared this at https://www.facebook.com/AHPforDecisionMaking

Muhammad Saad
Muhammad Saad
5 years ago

Aoa Sir.Hope u are fine. i am studying geo informatics engineering From Nust.sir I just need to know how can i implement AHP in python for site suitability of vegetation type.. sir kindly plz send me any link or tutorial video in which AHP implementation in python for site suitability is described ..As this is Part of my final year project..Plz consider this its a request

‫يزيد الدرويش‬‎
‫يزيد الدرويش‬‎
5 years ago

I need AHPforArcGIS9.x

Hasan Zorba
Hasan Zorba
5 years ago

Hi, I use arcgis 10.2.2. ,yet the fundemantel problem is that we havent run Ahp for Arcgis using python.This programme should be compatible my using arcgis .So do you have any document to run this process ? Should you sent me with pdf or word? Thank you

pankaj
pankaj
4 years ago

I am not getting step 1 and step 2 script with AHP tool. Can anyone help me with this?

Mohammad Hosseini
Mohammad Hosseini
6 months ago

Thanks