How to deal with inconsistent Chinese maps on iOS

2019-02-04 02:36发布

For Chinese maps on iOS 6, it seems that MapKit selects map provider based on your where the device is located. If you're in China it will use AutoNavi maps, and else it will use the default Apple maps. To complicate things, the AutoNavi maps seem to be transformed in the same way that Google's maps on iOS 5 are, whereas the default Apple maps are not transformed.

By transformed I'm talking about the fact that all maps in China are transformed, although this is not true. Rather, some maps in China are transformed, while some are not.

This transform makes it difficult to place annotations correctly on the map since the map is generally offset about 500 meters. Since it's not possible to reverse the transform of the actual map, the solution is to apply the same offset to the annotations.

There exists non-trivial ways to inverse the transform, at least for limited areas. The problem in iOS 6 is knowing whether or not the map is transformed to be able to compensate annotations appropriately. On iOS 5 this problem did not exist since the transformed maps were used consistently.

The Shanghai maps below illustrates the situation (the actual transform offset is not demonstrated).

ios 6 chinese maps

So, would there be any way of knowing in run-time whether transformed or non-transformed China maps are used? Other ideas for dealing with this?

Edit: Routing network traffic through a proxy in China changes map apperance in the simulator, so the choice of map provider must be based on IP.

3条回答
小情绪 Triste *
2楼-- · 2019-02-04 02:49

Couldn't you get geo data from the phone and if they are in china apply the transformed annotations?

查看更多
做个烂人
3楼-- · 2019-02-04 03:02

It's about Martian Coordinate Systems. Check this out: https://github.com/Mardinate/Mardinate

查看更多
倾城 Initia
4楼-- · 2019-02-04 03:06

You could always use Bing Maps SDK if you absolutely need consistency - that is consistency between iOS versions and between people in USA or China. Although I would recommend sticking with MapKit.

查看更多
登录 后发表回答