# Is azimuth preserved in EPSG:3857?

I am trying to draw the outlines of drone images using OpenLayers. The drone has recorded a "yaw degree", which should be the azimuth. However, when I place the rectangles on the map, their orientation often seems a bit wrong.

I expect them to align along the direction of travel but it often appears as if drone had traveled slightly sideways:

I was starting to wonder whether it might be something to do with the projections. Do I need to somehow transform the angle to make it correct on an EPSG:3857 map?

Here's how I'm drawing those rectangles at the moment:

``````// We start out having the center coordinates and the bearing from the image metadata
// const center, bearing
// As well estimates of dimensions (using FOV and altitude)
// const width, height

// Create a width x height rectangle around the center
const left = center[0] - (width / 2 / scale)
const top = center[1] + (height / 2 / scale)
const right = center[0] + (width / 2 / scale)
const bottom = center[1] - (height / 2 / scale)

const polygon = new Polygon([[
[left, top],
[left, bottom],
[right, bottom],
[right, top],
[left, top],
]])

// and rotate the rectangle around the center
// is this correct?
polygon.rotate(-bearing * Math.PI / 180, center)

feature.setGeometry(polygon)
``````
• You really shouldn't do any mapping with mensuration in Web Mercator. All distances are always wrong, so lines of constant bearing isn't going to do you much good. Use a local UTM or Albers or Lambert Equal-Area Conic. Commented Jul 7 at 21:59
• To avoid projection related problems you could use `turf.js` library to create rotated rectangles in non projected coordinates (using `destination` and `transformRotate` methods), and then project them in OpenLayers. Commented Jul 8 at 13:10
• Thanks @TomazicM, I prepared the polygons via turf and converted only the final polygon, I'm still getting pretty much the same issues. I guess it's just how my bearing data is. Commented Jul 8 at 19:39
• Yes, that would indicate that drone is actually flying a bit sideways or that camera is not attached at the right angle. Commented Jul 8 at 20:07
• DJI drones store a drone yaw in exif tags and a camera gimbal yaw as xmp tags. Maybe your drone does the same and you have the wrong yaw? exiftool.org/TagNames/DJI.html
– GBG
Commented Jul 16 at 0:30