Avoid divide by zero if samples equals zero

Signed-off-by: Tod Fitch <Tod@FitchDesign.com>
Calculate merged elevations per suggestion from @aelmahmoudy

Signed-off-by: Tod Fitch <Tod@FitchDesign.com>