How to – Use Offline Mapping

Overview

The location question of SurveyToGo can work in two formats, online and offline. When used in online mode the location question will use Google maps as a mapping engine. You can read more about how to use the online mapping mode of the location question here. In some cases where network connection is not available you might prefer to use the offline mode of the location question. While it requires more work to set the offline mode up it will provide you with the ability to have a full location question up and running while being completely offline. The mapping information used will be based on OpenStreetMap. To use offline maps:

  1. Step 1: Install Mobile Atlas Creator
  2. Step 2: Create the offline map file for the relevant area
  3. Step 3: Load the map to the SurveyToGo survey and configure the location question to use that file as a map source.
  4. Step 4: Optionally controlling the start position of the map and zoom level
  5. Step 5: Showing the map on the tablet

Step 1: Install Mobile Atlas Creator

If you do not have the “Mobile Atlas Creator” app installed on your PC, please first install it by following these steps:

  1. First, download the zip file from this location: http://www.dooblo.net/downloads/Mobile%20Atlas%20Creator%201.9.16.zip

  2. Then extract the file to your preferred location on your hard drive and start the app by double clicking on “Mobile Atlas Creator.exe”:

  3. The Mobile Atlas Creator app should start and you should be asked for the atlas format you wish, please select “Osmdroid SQLite” and click on OK:

  4. You can now move on to the next step.

 

Please Note: You might be facing this message when you first login 

This is because one of the maps source providers called MapQuest, which is the default map source, is no longer offering offline maps and in order to use them you need to register.

Workaround:

1. Add Google Maps - Download the google2.xml file (attached to the article) and copy it to the mapsources folder where the application is installed. 

 

2. Choose Google map source from the list in the upper left corner as shown in this screenshot:

 

Step 2: Create the offline map file for the relevant area 

To create the offline map of your choice, please make sure you have the Mobile Atlas Creator app installed and launched. If you do not have it ready, please refer to the previous step in order to download & install the app. To create the offline map, please follow these steps:

  1. Launch Mobile Atlas Creator

  2. If a previous atlas was loaded, first clear the Atlas by right clicking on the atlas and selecting “Clear Atlas”:

  3. Now, zoom into the relevant area you wish to create a map for. You can use the right mouse button to move around the map and the mouse-wheel to zoom in and out. Once you are around the required area, use the left mouse-button to mark a selection and then click the “Add selection” button to add this selection to the atlas. (Please read the next step about zoom levels before adding the selection):



  4. Please pay close attention to the “Zoom Level” boxes that are ticked:

    The higher the zoom level that is ticked the more details the offline map will include but in turn the bigger the file that will be generated. In any case do not check zoom level 18 as it will create a huge file and level 17 already includes individual street level maps. We recommend checking up to zoom-level 16 for areas which are bigger than regular cities and 15 for areas as big as a country.

    Important Note:
    If a 17 zoom-level is chosen for a big area the resulting offline map file will be huge and probably will not be able to run on the device. Please only choose zoom level 17 in case you need the individual street level maps. Zoom level 16 will have street level information as well but some smaller streets will not display.

    In case you wish to see the relevant zoom level, you can always see it on the map itself so that you can decide if you can do with a certain zoom level:

  5. If you added the selection and ticked an inappropriate zoom level, you can always change it by right clicking on the “Layer” you added and selecting “Delete”:


    Then, you can check/uncheck the relevant zoom level and click on “Add selection” again:

  6. Once everything is set correctly you are now ready to create the offline maps file. To do this, click the “Create Atlas” button:

  7. The app will start generating the offline maps file and you will see the progress of the file creations. The creation process might take some time as the maps will be downloaded from the internet:

  8. Once it completes, click on the “Open Atlas Folder” button to get to the file that was created:

  9. You will see a folder was created with the date and time of today, and inside the folder there is a file with extension “.sqlite”. This is the file you need to use in the next part of the guide:


    You can rename this file to any file name you wish to be more descriptive.

  10. If you need to generate a new offline maps file you can repeat the steps in this part of the guide. Just make sure to always take the file from the most recently created folder.

Step 3: Load the map to the SurveyToGo survey and configure the location question to use that file as a map source

Once you created the “Layer.sqlite” file (you can rename it to any file name you wish) you are now ready to use this file from within the SurveyToGo location question. There are 2 ways of using this file:

  1. Copy the file to the devices by yourself, then point the map question to use the already existing file.
  2. Attach the file as a survey attachments, then point the map question to use the survey attachment. 

There are pros and cons to each approach, but our guideline is to use option #1 for any SQLite file bigger than 15MBs:

 

Approach Pros Cons
Option 1: Copy the “Sqllite” file to the devices by yourself
  • For large “Sqllite” files, copying the files to many devices will be much quicker
  • Syncing of the survey will be much quicker as the survey itself will not include the “Sqllite” file as an attachment
  • The download of the file to the devices is done manually by the customer and not by SurveyToGo
Option 2: Attach the “SQLite” file as a survey attachment
  • SurveyToGo will take care of downloading the file to all the devices that sync this survey
  • The upload of the SQLite file will take time, if this file is over 15MB of size the upload of the file might fail due to file size restrictions.
  • The download of the SQLite file will be much slower as it will use the SurveyToGo download attachments mechanism

We will now show you how to use each approach. 

Option 1: Copy the “Sqllite” file to the devices by yourself

In this approach you simply copy the file to the device and not the name of the file. Then, in the survey do the following steps:

  1. Add a location question, then in the answers check the “Use offline mode”:

    2. Next, switch the offline maps source and select “New”:

       

    3. Now you’ll need to add a new attachment source by clicking on the “+” sign, and entering the path to         the file that you copied to the device. The script to use is in the form of:                                               list.Add("$ROOT$/Layer.sqlite","1"); , lastly you need to give this attachment source a name and               click on OK to approve:   

        

    4. Finally, select the new Attachment Source name you just created from the list:

       

Option 2:

In this approach you first attach the sqlite file to the survey and then configure the survey to use the attachment. Here is how to do it:

  1. Click the main survey and then select the “Advanced tab”, and click on the “Edit Survey Attachments” link:

     2. Click the “New” button to add a new attachment: 

        

    3. Click the “Add files” button and locate the sqlite file. Then click on open to add it to the list of files to        upload:

        

    4. To complete the upload click the “Upload” button:

        

    5. Once the upload complete you will be able to use this uploaded file when configuring the location             question.

    6. First, add a location question, then in the answers check the “Use offline mode”:

       

     7. Next, switch the offline maps source and select “New”:

       

     Important note:

     This step is slightly different than in the other option, please note the change in the script syntax and        do not use the script from the previous approach.

     Now you’ll need to add a new attachment source by clicking on the “+” sign, and entering the name of      the attachment. The script to use is in the form of: list.AddFromAttachment("Layer.sqlite"); lastly you        need to give this attachment source a name and click on OK to approve:

     

 8. Finally, select the new Attachment Source name you just created from the list:

     

Step 4: Optionally controlling the start position of the map and zoom level

If you wish you can control the start position of the map and the zoom level so that the map is centered correctly when starting the map. To do this, follow these steps:

  1. Switch to the “Scripts” tab of the question and click on the “Advanced scripts” link. This will open up the global function library of this survey:

    2. Now, add the following function to the script library:

      

       Here is the code:

       function OnMapShowing(inCallback, inQuestionIndex, inIteration){                                                         inCallback.setMapCenter(CreateCoords(51.522202,-0.147206));

        inCallback.setZoomLevel(13);

        inCallback.setSatellite(false);

        }


You can of course change the coordinates to the coordinates you wish to center the map on. This function will be called each time the map will show and it will make sure to center the map to the relevant coordinates and also set the zoom level to 13.

Step 5: Showing the map on the tablet

Once everything is configured correctly and after the survey is synchronized to the tablet the location question will show on the tablet:

Clicking on the “Open Map” button will open the map and center it correctly, then allow you to pin the location to where you wish and also play with the zoom level:

Then lat/long of the pinned location will be captured once the OK button is pressed:

 

That’s it!

 

 

 

Visit us at: http://www.dooblo.net

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.