Setting up the POIs management system
To set up the POIs management system you will need a server supporting PHP and MySQL. Then, follow the steps below.
1) Create a new DB. Write down its name, host (it should be localhost), username and password;
2) In the project main folder find the dbimport.sql file and import it into your newly created DB;
3) Upload the directory arpoisadmin onto your server root directory.
4) With your favorite editor, open the file comuni.php, in the include directory and edit the following information:
Now, everything should work atwww.yourdomain.com/arpoisadmin. Please note, that if you plan to change the management system directory name or path, you may want to adjust more parameters in comuni.php.
Using the management system is straightforward, probably you will create your first POI in seconds. To create a new POI, click on Add a new POI and give all the related info (name, latitude, longitude, altitude, URL, thumbnail image, best 96x96 pixels in size).
Please note that both latitude and longitude should be decimal numbers. For instance, adding the info for Trafalgar Square in London, you will write 51.507778 and 0.1275 respectively.
Altitudeis a mandatoryfieldaswell and that's because you can run the risk of showing many POIs at the same altitude if you give 0 as value here. Altitude is expressed in meters. We are aware that you can't often get this information for your POIs. In this case, although we don't suggest the following hack, you may want to give fake altitudes to your POIs, paying attention to use always different values. Please, check london.xml file where POIs have fake altitudes, as the real altitude for these POIs was unknown or not relevant.
Also, note that the URL should have no http:// prefix. In addition, the image you will upload is serving the purpose to be a small thumbnail for the POI button and NOT a full image! This is the reason why it should be 96x96 pixels in size.
The POIs management system allows you to delete and edit existing POIs, too.
The main task of the management system is to output an XML file that you may want to give in xCode in the method prepare, as the value of url variable. The path to your XML file will be www.yourdomain.com/arpoisadmin/poisxml.php
A sample of a well structured XML file is london.xml, that you will findwithin the template files. You may want to avoid to use our POIs management system and create the XML file with your favorite editor, such as Brackets, by using our template. However, this manual method could be time consuming.
Setting up the iOS app
Our xCode template is meant to be integrated with your project. Technically, allyou need is the content of ViewController.h and ViewController.m and the relative XIB in the storyboard.
The camera overlay itself, where POIs are shown on camera, has no graphic interface in the storyboard, as it is built programmatically.
Our iOS template is fully customizable. Here is the main methods you may want to take into account:
chosenDistance = 25000;
Thisvaluelimits the range (in meters) for POIs to be shown. For instance, ifyouwantthatyourPOIs are not displayed on the camera viewif more distant than25 km (or 25000 meters) from the user position, set thisvalueat 25000.
Note that this value must be the maximum value of the slider in the XIB of the View Controller too!
locManager.headingFilter = 10;
The minimum angularchange (measured in degrees) required to refresh the cameraview. Although a lowernumberwould lead tomore precise results, we strongly suggest to set this value as 10, in order to give user the chance to swipe right on buttons and remove them temporarily and, most of all, to stress not the device. Thevalue set as 1, in fact, would mean a refresh of the camera view, whenever the device is moved.
NSURL *url = [NSURL URLWithString:@"http://path/to/xml/data"];
Here you can indicate the XML file to take into account.
In thismethodyou can reskin the wholebuttonsgraphic. Buttons are createdprogrammatically.
The main view of them is a UIView, called viewBtnBg. This view has three sizes, depending this from the distance between the POI and the user (less than 1000 meters, between 1000 and 10000 meters, and more than 10000 meters). You can adjust these values according to your needs.
On this UIView, we add three elements, an UIImageView for the thumbnail and two UILabel for the title of the POI and the distance from the user location.
To POIs buttons, three different actions are attached. If you tap the buttononce, you'll call Google Maps asking for the direction from the user location to the POI. If you tap twice, you'll reach the website you specified for the POI in the XML file. Finally, if you swipe right on the button, you remove it temporarily until the view is refreshed.