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

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
RyanKDalton
  • 23,068
  • 17
  • 110
  • 178

1 Answers1

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.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
VietThanh Le
  • 1,470
  • 12
  • 12
  • 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. – RyanKDalton Jan 21 '11 at 17:25
  • http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=BDF21676-1422-2418-34E6-A29C6BAC8A0B contains other def's for various other stats which you might find useful –  Jan 21 '11 at 18:57