In this paper, we propose a novel approach of designing the velocity function and the trajectory for a UAV to efficiently achieve location-dependent visual coverage. Specifically, the UAV dynamically adjusts its altitude to photograph terrestrial polygons with different image resolution requirements. Unlike prior work that assumes the UAV speed is constant, the proposed approach allows the UAV to change its speed. To minimize the task completion time, we put forward a novel approach that is composed of three algorithmic components. The first component uses an aggressive method for selecting the UAV photographing altitudes, designs the UAV velocity functions, and derives the UAV flying times for all pairs of regions. Based on the UAV flying times rather than the distances, the second component utilizes an auxiliary traveling salesman problem to determine the visited order of terrestrial regions. For each terrestrial region, the third component generates candidate coverage paths and picks up the coverage path based on the UAV flying time. We also derive analytical results on the UAV trajectory length. Large-scale simulation results indicate that the proposed approach outperforms a two-dimensional trajectory planning algorithm and a greedy algorithm for planning a three-dimensional trajectory in terms of the UAV task completion time.