The elevation gain when create course on PC, load the course from GC (iOS), and the actual gain during the run are different?

How can I can accurate elevation gain estimate when create running course on Garmin Connect for better planning?

I created a course in CG for running, about 1667 feet gain.

And the elevation was only 1058 ft when I complete the course.