## 3 Proposed Real-Time 3D Mapping-Aided (3 DMA) GNSS-Positioning System
### 3 DMA GNSS Positioning Algorithm
#### 3.3.1 Skymask Context-Based Candidates Sampling  
An effective hypothesis positioning candidates sampling is important for 3 DMA GNSS. The sampling area must cover the receiver location to achieve the theoretically best performance. Enlarging the sampling radius ensures the receiver location is being covered. However, this creates a massive computational load for the low-end microcomputer, which is not practical for a real-time application. Required computational time is proportional  
Figure 2: Geo-tagged skymask generation from NYC 3D model. to the number of sampled candidates and received satellites. The computational time is within the necessary output rate. Thus, we proposed to use the surrounding skymasks and principal component analysis (PCA) to determine the street direction and distribute the sampling candidates effectively. Candidate distribution is based on the weighted least squares (WLS) for the first epoch and using the previous epoch FGO solution as the initial position after it is available. An initial circle with a sampling radius, \(R\), e.g., 50 m, is set up empirically to estimate the surrounding environment by weighted averaging skymask, \(\overline{\mathbf{SM}}^{zz}\). \[\overline{\mathbf{SM}}^{zz}=\frac{1}{\sum w_{k}}\sum_{k=1}^{K}w_{k}\mathbf{ SM}_{\mathbf{F}_{k}}^{zz}\text{ where }\mathbf{P}_{k}\in\{|\mathbf{P}-\mathbf{x}_{init}|<R\} \tag{1}\]  
where \(\mathbf{SM}_{\mathbf{P}_{k}}^{zz}\) is the skymask of location \(\mathbf{P}_{k}\) where it is within the sampling radius \(R\) based on the initial location, \(\mathbf{x}_{init}\). \(az\) is the array index that represents the azimuth angle from \(0^{\circ}\) to \(359^{\circ}\). \(w_{k}=|\mathbf{P}_{k}-\mathbf{x}_{init}|^{2}\) is the weighting of location \(\mathbf{P}_{k}\) based on the distance between the initial location, \(\mathbf{x}_{init}\). The averaged skymask is then converted to vectors in the Earth-Centered-Earth-Fixed (ECEF) frame together with the transformation matrix, \(\mathbf{R}\), expressed as,  
\[\mathbf{q}^{az}=\mathbf{R}\cdot\left[\sin az\cdot\cos\overline{\mathbf{SM}}^{ az},\cos az\cos\overline{\mathbf{SM}}^{az}\right] \tag{2}\]  
where \(\mathbf{R}\) is the transformation matrix that converts the vector in the local frame to the world frame in ECEF. Thus, we can form the variance-covariance matrix, \(\mathbf{Q}\),  
\[\mathbf{Q}=\mathbf{q}^{\text{T}}\mathbf{q} \tag{3}\]  
Therefore, we can obtain the eigenvalues, \(\boldsymbol{\lambda}= \begin{bmatrix}\lambda_{1}&0\\ 0&\lambda_{2}\end{bmatrix} \), and eigenvectors, \(\mathbf{V}= \begin{bmatrix}\mathbf{v}_{1}&\mathbf{v}_{2}\end{bmatrix} \), from the variance-covariance matrix, \(\mathbf{Q}\). Note that the eigenvalues and eigenvectors are sorted in descending order, e.g., \(\lambda_{1}\) and \(\mathbf{v}_{1}\) denotes that they are with the largest eigenvalue. In addition, the eigenvector with a larger eigenvalue can be interpreted as the street's longitudinal direction. Finally, we can filter the initial circle with the ellipsoid based on the determined eigenvalues and eigenvectors. The length of the semi-major and semi-minor axes are \(R\) and \(R\cdot\
icefrac{{\lambda_{2}}}{{\lambda_{1}}}\), respectively. The direction of the semi-major and semi-minor axes are \(\mathbf{v}_{1}\) and \(\mathbf{v}_{2}\), respectively. \[\mathbf{p}_{j=1\ldots J}=\left\{\mathbf{p}_{k}\in\frac{\left(\mathbf{d}_{k} \cdot\mathbf{v}_{1}\right)^{2}}{R^{2}}+\frac{\left(\mathbf{d}_{k}\cdot\mathbf{ v}_{2}\right)^{2}}{\left(R\cdot\
icefrac{{\lambda_{2}}}{{\lambda_{1}}} \right)^{2}}<1\right\} \tag{4}\]  
where \(\mathbf{d}_{k}=\mathbf{P}_{k}-\mathbf{x}_{init}\) is the vector between the candidate's position, \(\mathbf{P}_{k}\), and initial location, \(\mathbf{x}_{init}\). The distributed candidates are an ellipsoid with a semi-major axis of 50 m. The separation for each candidate is 4 m. The above settings were determined empirically and suitable for real-time processing on the low-end microcomputer used in this study.