Aiming at the problems of poor positioning accuracy in the indoor and outdoor junction areas and the loss of positioning signals and discontinuous positioning results during the transition from the indoor area to the outdoor area, this paper proposes a machine learning method to solve the positioning problem in the indoor and outdoor junction areas and the switching problem of positioning methods. An indoor and outdoor positioning switching algorithm based on PSO-BP(Particle Swarm Optimization-Back Propagation, PSO-BP) and BP(Back Propagation, BP) neural network is designed. Through this algorithm, the position of the positioning tag can be judged independently and the coordinates of the positioning tag in the indoor and outdoor junction area can be predicted independently. The experimental results show that the accuracy of positioning area judgment based on PSO-BP neural network can reach 99.91%. The indoor and outdoor boundary area coordinates obtained by BP neural network prediction method are lower than the root mean square error of UWB(Ultra Wide Band, UWB) indoor positioning method and BDS(Beidou Navigation Satellite System, BDS)positioning method. The algorithm model proposed in this paper effectively improves the positioning problem of the indoor and outdoor junction area and the positioning problem of the transition from the indoor area to the outdoor area, improves the positioning accuracy and positioning stability of the indoor and outdoor junction area, reduces the positioning cost, and has strong practicability.