An indoor and outdoor positioning method and an indoor and outdoor positioning system are provided. The indoor and outdoor positioning method is characterized in that a plurality of nodes are set, and each node includes a CPU, a GNSS receiver, an IMU, and a UWB positioning module; for each node, the attribute is set as Tag before the node gets the position thereof, and the attribute is set as Anchor after the node gets the position thereof, which provides a reference position for the positioning of the other nodes; information transmitted between an Anchor node and a Tag node includes ranging information and the position information of the Anchor node; and the nodes of which the attribute is set as Tag are compared in GNSS, UWB and IMU positioning results and positioning accuracy according to a preset Anchor node, the node of highest positioning accuracy is selected, whether the positioning accuracy is over-limit is judged, and if the positioning accuracy is not over-limit, the Tag is converted into Anchor to provide positioning service for other Tags. The scope of positioning is expanded, the system cost is reduced, the reliability and the system scalability are improved, and the privacy of positioning users is protected.