6

I've been hunting around ArcGIS 9.3 and having no success at finding a tool/function that can give me the median (not the mean/avg) tabular value of a spatial database. For example, if I have a data layer of mountain peaks, I would like to be able to determine the elevation of #35 of 70 mountain peaks that exist within a county.

Conceptually it should be pretty easy. Count the total records, sort by elevation ascending, get the value from the elevation field for record # (count/2). Would I need to script this out in Python, or am I missing something obvious that would allow me get this more quickly? I find it hard to believe no one else has had a need for this function and created a solution.

To add some complexity to the matter, what if I wanted the median elev value for peaks in every county within the state in a single table? Basically the same output format as Frequency or Summary Statistics tools when using the Case Field option.


I was able to adapt the script linked by @VietThanh Le to meet my needs. I have posted the updated script and ArcToolbox at: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=A0CD1751-1422-2418-882E-001EE0DC0D35

  • would you consider updating your tool for use in 10.1? – Pat Johnson Jul 2 '13 at 20:29
2

I found a python script called Calculate Median Value in ArcScripts, but I have not tried it:

This script tool calculates the median value of one entire field and posts that single median value to every row in one other entire field.

  • That's a great start, thanks. It doesn't quite have all the functions I am looking for (write to a standalone table, Case Field, etc) but the Python code to generate the median is what I really need, and should be able to code around that to make it fit my needs. I will repost the code and solution once I get it complete. – RyanDalton Jan 21 '11 at 17:25
  • resources.arcgis.com/gallery/file/geoprocessing/… contains other def's for various other stats which you might find useful – user681 Jan 21 '11 at 18:57

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.