Geolocation accuracy improvement for automobile in vibrant urban area

5 minute read


Global Position System (GPS) is a satellite-based navigation system operated by the United States Air Force which provide the geolocation, time and derived velocity where there is an unobstructed line of sight to four or more GPS satellites with the accuracy ranging from 100ft to 15ft (30m - 4.5m) radius.

For instance, mobile phone utilizes Assisted GPS (A-GPS) from telecommunication tower cells to speed up the triangulation process and provide a better result of the actual location. With Google Maps, the live geolocation can be displayed and even broadcasted in real-time with the help of already collected geography data to place the vehicle’s position onto the correct path via Google Map SnapToRoad API.

Ultimately, the goal for this type of application is to ensure the trajectory of moving vehicles is correct, i.e. moving on roads and provide better user experiences.

Side note: Read more about Third Generation GPS upcoming launch by the United States Air Force collaborate with SpaceX and their Falcon 9 rocket.


Follow the official documentations to setup your Google account and create a Google Cloud Platform Project with Billing Enabled.

Google Free Tier introduces a 12 months, $300 trial 1 for new user to learn the basics with several limitations which will not be an issue for our setup.

Well ! To be perfectly candid, it does depend on how much requests you invoke for your map display, so make sure to verify it and there are options to limit user request or malicious attempt to work up your bill.

If you have already setup your Google Maps Java API, well done ! Skip to the second part of the tutorial for instruction on how SnapToRoad API work or read more about how GPS data from the satellite can be interpreted.

GPS Information Standard

The National Marine Electronics Association (NMEA) has developed a specification that defines the interface between various pieces of marine electronic equipment. Their standard permits geo-positioning electronics to send information to computers and to other marine equipment.

NMEA Sentences

GPS receiver communication is defined within this specification with the idea is to send a line of data called an NMEA sentence that describes essential piece of information that was pre-defined for sets of sentence and serving multi-purposes.

GPS receivers with the prefix of GP and is followed by a three letter sequence that defines the sentence contents. GGA - Essential fix data which provide 3D location and accuracy data.

Similarly, an analysis of another commonly used NMEA sentence can be found tabulated as below.

Recommended Minimum Data for GPS (GPRMC) data line analysis.

See full list of GPS receivers sentences (NMEA 2.0 Standard)

AAM - Waypoint Arrival Alarm
ALM - Almanac data
APA - Auto Pilot A sentence
APB - Auto Pilot B sentence
BOD - Bearing Origin to Destination
BWC - Bearing using Great Circle route
DTM - Datum being used.
GGA - Fix information
GLL - Lat/Lon data
GRS - GPS Range Residuals
GSA - Overall Satellite data
GST - GPS Pseudorange Noise Statistics
GSV - Detailed Satellite data
MSK - send control for a beacon receiver
MSS - Beacon receiver status information.
RMA - recommended Loran data
RMB - recommended navigation data for gps
RMC - recommended minimum data for gps
RTE - route message
TRF - Transit Fix Data
STN - Multiple Data ID
VBW - dual Ground / Water Spped
VTG - Vector track an Speed over the Ground
WCV - Waypoint closure velocity (Velocity Made Good)
WPL - Waypoint Location information
XTC - cross track error
XTE - measured cross track error
ZTG - Zulu (UTC) time and time to go (to destination)
ZDA - Date and Time

Geolocation Stream

The initial step to get GPS data took place in simulation environment for a better understanding of the NMEA sentences, specifically tailored for the GPS Receiver, i.e. GPRMC, GPGGA and etc.

Simulated geolocation data stream in Proteus using Virtual Terminal. Any microcontrollers support Serial Communication can also be used. More on embedded system protocol.

In actual implementation, the similar set of strings (line of data) can also be found.

Actual geolocation data stream from GPS receiver to a microcontroller within the Arduino Leonardo board. Try to interpret and lookup the posted position

SnapToRoad API

Application Programming Interface (API) acting as a medium between different programming languages, platforms and hence the name. That is, the Google Map API provides a convenience approach to utilizes the geography data that are necessary to correctly identify the roads without too much hassle.

Syntax Explanation

With Google Map Java API enabled, the SnapToRoad specifically can be invoked using HTTP Request. The result is a similar set of data, with the points snapped to the most likely roads the vehicle was traveling along.


The required parameters include the path, i.e. latitude/longitude pair divided by the character | and obviously your API_Key. For instance, a set of three coordinates with optional flag interpolate enabled in complete HTTP request form as below.


Note: As of August 2018, Google introduces new Pricing Plan for their product including Roads API.

Compared Results

The below results are indication of three different implementation including Raw Geolocation, Filtered Digitally, Roads API displayed using Google MyMap and were tested under two opposite scenarios, i.e. freeway express and downtown centre.

On Freeway with almost no tall building and trees, the Raw Geolocation data is slightly off at only 26ft (8m) but still can be improved as in the case of Filtered Digitally and Roads API

The main target for geographically monitoring a large amount of vehicles is usually resided in urban area where it is crowed with enormous wireless data transmission and signals bounced off tall buildings as well as other potential interference.

In Downtown Centre, a median of 55ft (17m) was found of the Raw Geolocation and while relatively better, Filtered Digitally still could not compare to Roads API in term of accuracy

Note: This comparison is relative with only points and using an embedded GPS receiver instead of mobile phone which would have been better in term of performance as previously discussed.

Troubleshooting (Extra)

  • Authorization issues with API Key

Head to Google API Console for Developer and select your project.

Then hit Tab APIs Under Enabled APIs select Roads API Select Credentials sub-menu and request for new API Key. Similar instruction for Cloud Console in another article.