Geometric reasoning under uncertainty for map-based localization