MKPolygon covering pole

52 Views Asked by At

I'd like to create an MKPolygon with a portion that covers a pole.

Drawing a polygon around 0 N 0 E works as expected:

let coordinates = [
    CLLocationCoordinate2D(latitude: 20, longitude: 0),
    CLLocationCoordinate2D(latitude: 0, longitude: 20),
    CLLocationCoordinate2D(latitude: -20, longitude: 0),
    CLLocationCoordinate2D(latitude: 0, longitude: -20),
]
let polygon = MKPolygon(coordinates: coordinates, count: coordinates.count)

Shaded square around 0 N 0 E

Attempting to draw a similar square around 90 S 0 E produces a straight line:

let coordinates = [
    CLLocationCoordinate2D(latitude: -70, longitude: 0),
    CLLocationCoordinate2D(latitude: -70, longitude: 90),
    CLLocationCoordinate2D(latitude: -70, longitude: -180),
    CLLocationCoordinate2D(latitude: -70, longitude: -90),
]
let polygon = MKPolygon(coordinates: coordinates, count: coordinates.count)

Straight line at 70 S

It seems like the coordinates may be converted to map's projection before the path is drawn, although I'm not sure.

Setting .mapType = .hybridFlyover doesn't change much:

Unfilled circle around pole

What is the correct way to create an MKPolygon around the pole?

0

There are 0 best solutions below