Issue with setting waypoints relative to the origin on a mapbox bbox image via GeoReference Plugin

Hi guys,

I (pretty much still learning) am currently working on a blueprint only project in UE5.6 for iOS. It’s a kind of navigation system where the player’s real world position is visualized on a mapbox map tile as they walk to waypoints i set before runtime.

My problem is: The waypoints do not appear on the correct locations on my map image although the relative distances in x,y coordinates to the center seem to be correct.

What already works:

  1. I use the GeoReferencing Plugin (my settings: Projected CRS: EPSG:3857; Geographic CRS: EPSG:4326) to track the location of the iPad in realtime.
  2. I am already able to download an image (bbox format) from mapbox that contains my starting location right in the middle. Through a custom calculation that contains this location defined as geo coordinates as well as a mapbox zoom (int) and another pixel format (int) i get the edges of my box also as geo coordinates. These are put into an append (string) that forms the url i put into “download image”. The image is then put into the texture parameter of a material I created. My static mesh inside the blueprint then gets this material set and finally changes its size (the original mesh has a size of 100x100 uu). Currently I calculate the size this way so the size should correspond to meters inside Unreal:

I download the image once at start and it will not be updated during the rest of the runtime.

I don’t directly transform geo coordinates into Unreal coordinates since that would lead to positions far away from Unreal’s origin which could lead to floating point precision issues (or so I’ve read). To normalize I manually subtract the Unreal coordinates of my starting location from the Unreal coordinates I get for my waypoints.

My problem and how it looks on my map:

I use hardcoded geo coordinates and not realtime GPS right now for testing purposes. The red cones serve as references to where the waypoints should spawn respectively. The calculated waypoints (that are off) are the blue ones.

How I set the locations for the (blue) waypoints:

To pinpoint the error I divided the x and y values of the target locations (red cones) through the location the waypoints currently are spawned (blue cones). I got these scale factors: about 40.56 for x and about 42.1 for y. (These values were calculated at latitude around 49. I also tested this with a city that lies on lat 39 and the values I got were about 52 and 56 if I remember correctly.) Hardcoding these values is not an option though since the app should work everywhere in the world.

I am aware that mapping the real world and also transferring this information on a flat surface involves complex calculations. But I do not know how or from where these scale factors would come from, since these factors are not a multiple of 100 or the mapsizeinmeters value (see screenshot above).

I strongly believe that the map size and the coordinate values are not matching. My problem is that I think I would need a formula either for the map size or for the coordinates that works everywhere on earth.

Of course I am also open for any other helpful thought or solution. :slight_smile: