## 3 Proposed Real-Time 3D Mapping-Aided (3 DMA) GNSS-Positioning System
### Loosely-Coupled Factor Graph Optimization (LC-FGO)  
This study also optimized the 3 DMA GNSS solution as a batch via forming the graphical optimization. It is associated with FGO, connecting two consecutive epochs' solutions with velocity. The overall structure of the FGO process is shown in Figure 5.  
The error factor between the 3 DMA GNSS solution, \(\mathbf{x}_{t,3 DMA}\), and optimized state, \(\mathbf{x}_{t}\), is given by,  
\[\|e_{t,3\text{DMA}}\|_{\boldsymbol{\alpha}_{3\text{DMA}}}^{2}=\|\mathbf{x}_{ t}-\mathbf{x}_{t,3\text{DMA}}\|_{\boldsymbol{\alpha}_{3\text{DMA}}}^{2} \tag{7}\]  
where \(\boldsymbol{\alpha}_{3\text{DMA}}^{2}=\boldsymbol{\alpha}\cdot\text{diag} \Big{(}\Big{[}\sigma_{3\text{DMA},x^{\prime}}^{2},\sigma_{3\text{DMA},y^{ \prime}}^{2},\sigma_{3\text{DMA},z}^{2}\Big{]}\Big{)}\) is a diagonal variance matrix of the 3 DMA GNSS. Constant \(\boldsymbol{\alpha}=1\) is an empirically determined tuning factor for 3 DMA  
Figure 5: Structure of the proposed loosely-coupled 3 DMA GNSS and velocity via FGO. GNSS error factor. Variance at each axis is taken by the distance variation between the 3 DMA GNSS solution and candidates with the highest 10% likelihood score, divided by the separation of candidates, \(\gamma\),  
\[\sigma^{2}_{\text{3 DMA}}=\frac{1}{\gamma}\text{Var}(|\mathbf{x}_{t,3 DMA}- \mathbf{x}_{t,10\%}|) \tag{8}\]  
where \(\mathbf{x}_{t,10\%}\) represents the candidates' position with the highest 10% likelihood score. \(|\cdot|\) denotes the Euclidean distance between two positions. Receiver velocity, \(\mathbf{v}_{t}\), and clock drift, \(c\dot{\delta}t_{t}\), is estimated by the Doppler measurements of every satellite \(i\) at epoch \(t\), \(d_{t}=\left[d_{t}^{1},\ldots,d_{t}^{i}\right]\), via the least-squares (LS) method [41]. The error factor between consecutive epochs can be expressed as follows,  
\[\left\|e_{t,\mathbf{v}}\right\|^{2}_{\sigma_{\mathbf{v},t}^{2}}=\left\|\mathbf{ v}_{t}-\frac{1}{\Delta t}(\mathbf{x}_{t+1}-\mathbf{x}_{t})\right\|^{2}_{\sigma_{ \mathbf{v},t}^{2}} \tag{9}\]  
where \(\Delta t\) is the time difference between epoch \(t\) and \(t+1\). \(\sigma_{\mathbf{v}}^{2}=\beta\cdot\text{diag}\Big{(}\left[\sigma_{v,x}^{2}, \sigma_{v,y}^{2},\sigma_{v,z}^{2}\right]\Big{)}\) is a diagonal covariance matrix associated with the velocity \(\mathbf{v}_{t}\) at \(x\), \(y\)-, and \(z\)-axis, respectively. And constant \(\beta=5.2\) is an empirically determined tuning factor for velocity error factor. Parameters \(\alpha\) and \(\beta\) are determined empirically based on an open-source dataset [50] that covers different typical urban canyon scenarios. All results in this study share the same set of parameters. If tuning factor \(\beta\) increases, the integrated result approaches 3 DMA GNSS more. If decreasing the factor below 5.0, the optimized results will be much smoother, but easier to observe a drift if a wrong velocity is estimated. A constant velocity motion model [51] is included in this graph structure to provide a smoothed trajectory estimation. As this study assumed, users' motions are small with an ignorable acceleration. This factor minimizes the error between the position change between two epochs and the averaged velocity estimated via Doppler measurements, modelled as follows,  
\[\left\|e_{t,\mathbf{v}}\right\|^{2}_{\sigma_{\mathbf{v}}^{2}}=\left\|\frac{1} {2}(\mathbf{v}_{t}+\mathbf{v}_{t+1})-\frac{1}{\Delta t}(\mathbf{x}_{t+1}- \mathbf{x}_{t})\right\|^{2}_{\sigma_{\mathbf{v}}^{2}} \tag{10}\]  
where \(\sigma_{\mathbf{v}}^{2}=\frac{1}{2}\Big{(}\sigma_{\mathbf{v},t}^{2}+\sigma_{ \mathbf{v},t+1}^{2}\Big{)}\) is the averaged diagonal covariance matrix at time \(t\) and \(t+1\).