Map GPS coordinates

Environment

With the COALA plugin for unreal engine you can easily convert from GPS coordinates to scene coordinates.

Let's say you want to mark certain places on a world map. Unfortunately, you only have the GPS coordinates at your disposal.

You can find out how to solve this problem here.

Prerequisites

You need

        • the UE4 COALA plugin

    • an image of the world map that serves as a reference

    • GPS coordinates.

Example coordinates can be fetched very well from Google Maps.

Brief explanation of solution

We will create a "Custom POI" actor that is able to set its own position on GPS coordinates.

This solution is a very good basis for all kinds of other applications.

Set up UE4 editor

The Actor

The editor "world" setup

Using Google Maps to find GPS coordinates

BEWARE: On Google Maps there is first "latitude" (Y-value) and then "longitude"(X-value)

Feed your actor with the coordinates and press play

Below you can see the result.

If you select the actor in the world in "play" mode, you will see where he was placed in the scene depending on the GPS coordinates and the world size.

Technical background

The COALA plugin works with a fixed world size. The world circumference with 40.075 km is used for this.

For this reason, a scaling of x=2517.0 y=2688.0 Unreal units results for the reference world picture.

Furthermore GPS coordinates are used in the following range:

Longitude (x-value):

        • min -180°

        • max +180°

Latitude (y-value):

        • min -86°

        • max +86°

Q: Why is the altitude value (latitude) limited to 86°?

A: Keyword "Gimbal Lock".

Since this is a very simple example, the center of the world is taken as the reference. In a real world application, this would of course be the player GPS position.