swiftmapkitapple-mapscllocationcoordinate2d

Hey are coordinates from Apple Maps incorrect when used as a CLLocation in mapkit?


I’m working on an app that shows various places on a map (SwiftUI using mkmapkit in a uiViewRepresentable) and have found that coordinates are being placed off target for some reason. I have the data listed in Firebase as a map - Latitude value and Longitude value that is then transferred into a CLLocation in app.

Example of the problem is that Big Ben in London should be (according to Apple Maps) be at 51.50070N and 0.12455W doesn’t appear there in app (see image) but the app reports coordinates of 51.500702, 0.124610 - when tapped just below the annotation.reported coordinates clearly NOT Big Ben


Solution

  • The sign on the longitude is incorrect. According to my MKLocalSearch (and confirmed by dropping an annotation there), Big Ben is at a latitude of 51.5006854 and a longitude of -0.1245698. Note, that's -0.1245698 (aka, 0.1245698W) and not 0.1245698 (aka 0.1245698E).

    A longitude is defined “relative to the zero meridian, with positive values extending east of the meridian and negative values extending west of the meridian.”

    But your map is showing the coordinate east of the meridian, not the one west of the meridian. Here are the two coordinates:

    enter image description here

    And zooming in on that incorrect coordinate to the east, that's obviously where your map is pointing:

    enter image description here

    But Big Ben is to the west of the meridian:

    enter image description here