MapBase is an iOS native app starting point for map apps. Hot spots, visible as needles, can be added to a map. These hot spots are also clickable and thus can show a title and subtitle. All hot spots also have an invisible activity radius. When the devices position gets into the range of a hot spot, a configured sound will be played once and an image will animate to visibility.

The github repository can be found at: https://github.com/WiedemannD/MapBase

Description

XCode project overview

The simple XCode project consists mostly of default components. Two classes were added: MapAnnotation, which is the class holding the infos for a hot spot, and AudioPlayer, which does exactly what its title suggests.

The main code can be found in the ViewController class. In it, most of the startup processes and functions can be found.

Even without any Obj-C skills it's possible to create an individualized app with MapBase. hotSpots.plist, images.plist and sound.plist are included for that purpose. These three XML files control how the initial setting of the map should look like, what hot spots with what properties should be on the map and what sounds and images should be available to the framework.

Also visible in the project are the corresponding files to the mentioned sounds and images. It is not enough to just place the files in the corresponding folder, they also have to be added to the project via drag and drop.

Interaface elements like buttons etc. can easily be added or removed by editing MainStoryboard_iPhone.storyboard.

Adding sounds

When you've added sound files (preferably .mp3 or .m4a) via drag and drop to the project, they have to be registered in sounds.plist. The order in the corresponding array defines the index number of each sound file (e.g. the first added filename has the index 0, the second filename the index 1 etc.).

It should be mentioned that too big sound files could lead to lots of silence. Working file sizes seem to be smaller than 2MB, but the exact threshold hasn't been tested.

For testing purposes the app interface includes a Test sound button which plays the first registered sound.

Adding images

The process of adding images is analogue to sounds.

For testing purposes the app interface includes a Last image button which shows either the first registered image or the last shown image if one was already visible.

Map configuration

In the section startUpSetting of hotSpots.plistyou can define the initial position of the map via latitude (lat) and longitude (lon) values. Via regionDistance you can set the visible map area around the position in meters.

The second section spots can hold an indefinite number of hot spots. Each hot spot has to be configured via setting its postion lat and lon values, radius (the radius in which the hot spot has its activity area), title (bold first line in the tooltip which is visible when touching a spot), subtitle (second line of tooltip), soundId (the id previously mentioned that corresponds to a sound file, can be used multiple times) and imageId (analogue soundId the id corresponding to an image file).

The easiest way to add a new hot spot is to copy and past an old one and changing its values.

The plist editor of XCode, which has this rather nice interface to edit this specific kind of XML format, can sometimes be a little sticky. Be careful not to change the general structure (e.g. hierarchy and object types) of the included plists. Also when typing in big numbers don't use a syntax like "10.000" instead type "10000". XCode is then automatically putting in visual separation points.

For testing purposes the app interface includes a Reset button which resets the activated status of all hot spots, so they can be activated by position again.

GPS position testing with the simulator

XCode offers the possibility to simulate different GPS positions for the iOS simulators so you don't always have to run around to test geo apps (even though you ALWAYS should test an app on an actual device compared to the simulator in the end). When you click the little arrow in the toolbar of the console you get to choose between several default locations. Additional to that it is possible to add custom locations via .gpx files (http://en.wikipedia.org/wiki/GPS_eXchange_Format).

MapBase has several test gpx files included to test the corresponding hot spots.

Individualize it!

As the complete repository of MapBase is publicly available at https://github.com/WiedemannD/MapBase, feel free to change as much of it and add as much additional features as you want.

A good way to start would be to edit the function - (void)activateMapAnnotation:(MapAnnotation *) anno withDistance:(float) dist in ViewController.m. This function will be executed by each not yet activated hot spot, when the device position gets into the corresponding activity radius.