Police patrol is an essential and important means to maintain the public security and social stability. However, the role of the experience-based patrol in the development of the social security prevention and control system is also declining. To address the problems of a fuzzy patrol path and irrational path planning in the conventional patrol mode, practical alert data from 2019-2021 was pre-processed and used. On the basis of the Maklink graph theory, optimized patrol paths were improved using the ant colony algorithm. Specifically, 2D path planning in presence of buildings was analyzed. In the study, we take two sites with high incidence of cases as key patrol points and finally calculates the shortest 2D walking patrol path to avoid obstacles between the two points. This study facilitates daily patrol by policemen in terms of enhanced accuracy and practical effectiveness.