Due to the flexibility and mobility, unmanned aerial vehicle (UAV) can work as a movable sink to receive the data collected by sensors in wireless sensor networks (WSNs). This paper analyzes the capacity of UAV assisted data collection in WSNs, which provides a guideline for the parameters optimization of data collection in the presence of UAVs. In this paper, the service area of UAVs covers the area where sensors are distributed. The charging points for UAVs are placed around the service area, which provides energy supply for UAVs. The charging point is the starting and ending point of a UAV's trajectory. The service area is partitioned into multiple service cells. UAVs traverse these service cells to receive the data collected by the sensors in the service cells. The per-node capacity and average execution time of UAVs are used as two metrics to measure the performance of data collection in WSN. The upper and lower bounds of per-node capacity are derived respectively. It is discovered that the number of UAVs, the number of service cells and the trajectories of UAVs affect the per-node capacity of WSN. The per-node capacity can be optimized by adjusting the numbers of UAVs and service cells. Two path planning algorithms of UAVs are designed. With path planning, the per-node capacity is optimized to be closer to the upper bound, which achieves highly efficient data collection. The simulation results verify the correctness of the derived results.