MKPolygon to cover entire earth

若如初见. 提交于 2019-12-25 14:09:49

问题


I'm trying to create an MKPolygon that will cover the entire earth, but can't find the right coordinates.

my code looks like this:

CLLocationCoordinate2D pathCoords[5]={
    CLLocationCoordinate2DMake(0,-90),
    CLLocationCoordinate2DMake(0,90),
    CLLocationCoordinate2DMake(-180,90),
    CLLocationCoordinate2DMake(180,-90),
    CLLocationCoordinate2DMake(0,-90),
};

MKPolygon *result = [MKPolygon polygonWithCoordinates:pathCoords count:5];

I've found this article that can help: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.spatial.topics.doc/doc/geodnew1039296.html

But using those coordinated yields totaly different results in mapKit.

Can anyone help?


回答1:


For anyone interested, Anna was right, the code that solves the problem:

CLLocationCoordinate2D worldCoords[6] = { {90, 0}, {90, 180}, {-90,180}, {-90,0}, {-90,-180}, {90,-180} };

(by SaltyNuts)



来源:https://stackoverflow.com/questions/28721497/mkpolygon-to-cover-entire-earth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!