Inertial odometry is a typical localization method that is widely and easily accessible in many devices. Pedestrian positioning can benefit from this approach based on inertial measurement unit (IMU) values embedded in smartphones. Fitting the inertial odometry outputs, namely step length and step heading of a human for instance, with spatial information is an ubiquitous way to correct for the cumulative noises. This so-called map-matching process can be achieved in several ways. In this paper, a novel real-time map-matching approach was developed, using a backtracking particle filter that benefits from the implemented geospatial analysis, which reduces the complexity of spatial queries and provides flexibility in the use of different kinds of spatial constraints. The goal was to generalize the algorithm to permit the use of any kind of odometry data calculated by different sensors and approaches as the input. Further research, development, and comparisons have been done by the easy implementation of different spatial constraints and use cases due to the modular structure. Additionally, a simple map-based optimization using transition areas between floors has been developed. The developed algorithm could achieve accuracies of up to 3 m at approximately the 90th percentile for two different experiments in a complex building structure.