iOS Development: Apple Maps vs OpenStreetMaps
Displaying information on the map is often required when developing applications. That is why detalization and accuracy are very important. Also, having an offline access to the cartographic information when using your mobile phone may become an issue. All possible solutions to the stated problem will be discussed below.
Apple maps: drawbacks
The fact that Apple has replaced the time-tested Google maps with their embedded map service has put into rage a lot of its users. It has been criticized for numerous errors and poor map detalization million times. Since that time some errors have been corrected, but the problem of detalization is still relevant for USA , Western Europe. and some Asian countries. For example, in Russia, even in Moscow, according to Apple there are no buildings, and some cities look like cross-roads in the fields.
Another drawback of Apple maps is the difficulty to use it in the offline mode. The system can display the cached data if you do not have internet connection. However, it displays only those regions that a user viewed before. And there is no guarantee that one day the operating system of your iPhone won’t delete everything that was stored in it. It would be unpleasant to get into such a situation when travelling to some distant place where there are problems with the Internet or expensive roaming charges.
The alternative - OpenStreetMap
OpenStreetMap is an open project that is aimed at getting a free detailed map of the world. The project is constantly updated and improved by volunteers around the world. Any registered user can make changes and additions to the map. This ensures users high accuracy and detalization of cartographic data.
To illustrate our point, let’s compare several locations as shown on Apple embedded Maps and on OpenStreet Map Service
Pyongyang, the Capital of North Korea
Washington, Unites States
Barnaul, Russian Federation
OSMThere is no doubt that OSM is much more convenient and accurate in maps detailization. There are several ways of how we can use them in our applications.
Using OSM maps when developing iOS-applications
You can use the OSM maps in your project in several ways. We will consider the integration and use of maps with the help of MapBox iOS SDK. MapBox iOS SDK is a toolset for creating mapping iOS applications. Using it is like working with a standard MapKit framework. But it has a much greater flexibility in terms of visualization, customization and offline use. Moreover, this SDK is an open source. MapBox SDK can be attached to the project in several ways. You can find the description on the official website. Choose the most suitable for you. After connecting the SDK, we need to create an instance of RMMapView initialized with the source point of RMOpenStreetMapSource class in order to display OSM-map.
As a result, a well-detailed map of the world can be seen in our application. It was very simple, wasn't it?
Pre-caching and offline mode
Now let’s discuss how to help a user to download a map region in cache in advance and use a map if there is no Internet connection. First, we will add a UIProgressView to the screen to display the progress of a map downloading process and two buttons – the load button and the shift mode button. Then we transmit our own RMTileCache object into the map with the one year cache lifetime, for example.
To begin asynchronous data loading and progress tracking we will implement a processing method of tapping the button "Download" and support RMTileCacheBackgroundDelegate protocol. For example, we will download a map of Pyongyang which is displayed as a simple sign in the field and nothing around on the Apple's maps.
To switch the mode we use the property retryCount in RMOpenStreetMapSource. For the offline mode we set download retry number equals to 0, and for online – to return the default value that equals to 3.
Finally the user can pre-download the map of the city that he is going to visit. After that he just needs to switch the application to offline mode.
As we have seen, there is an excellent alternative to Apple maps which is quite easily integrated with applications. And if you implement an application designed for use in areas with insufficient Apple maps detalization, or it's unacceptable for you to have an offline mode, so when searching for Apple maps alternatives think about using OpenStreetMap and MapBox SDK.