Code to calculate geographic isolation