Path planning problem is one of core contents of UAV technology. This paper presents an improved heuristic algorithm to solve 3D path planning problem. In this study the path planning model is built based on digital map firstly, and then the virtual terrain is introduced to eliminate a significant amount of search space, from 3-Dimensions to 2-Dimensions. Subsequently the improved heuristic A* algorithm is applied to generate UAV trajectory. The algorithm is featured with various searching steps and weighting factor for each cost component. The simulation results have been done to validate the effectiveness of this algorithm.