Thursday 18 October 2012

Hiking in New Zealand (Milford Track) - The best way to get and consume Free Offline Topographic Maps for use on Android Phones

I'm about to go hiking on the Milford Track in New Zealand (one of the "Great Walks") which has the debatable title of being the "finest track in the world". I booked the huts throught the New Zealand department of conservation (DOC - http://www.doc.govt.nz/) - with much of the season well into 2013 already sold out. I was lucky to nab some of the last cabin places.

Looking at the map images online and Google Maps itself, it got me thinking that "fine" as the track  may be, I was still keen on having a GPS will full topographic maps along for the ride. I wasn't so keen on forking out for a dedicated GPS device, so I naturally looked to my Samsung SII Android phone as a solution.

Even though Google Maps added full offline capabilities in July 2012, there are many limitations to both the maps and the offline implementation which led me to search for much better solutions for a hiking GPS system. Google Maps offline is basically more of an "alpha" product which:
  1. Only Allows 6 offline mapping regions (not sure how they arrived at 6); each of which is limited to ~90MB.
  2. Doesn't currently allow layers (like topo or satellite images)
  3. Doesn't provide any kind of offline searching capability even within those offline maps (this requires a full data connection).
The Google Maps solution was a workable (though not slick) solution for guiding us on the drive to Te Anau Downs (where the boat to the Milford Track picks up walkers). However, Google Maps just has the track at its most basic level - not have enough detail to help with indicating how far we are away from the next cabin.

I found a good solution was to do the following for full offline maps for the Milford Track:
  1. Download and Install to the Mobile Atlas Creator (MOBAC) on your PC (Windows/Linux/OSX). You may also need to download and install the Java Runtime Environment (JRE) 1.6 or above). Download from http://mobac.sourceforge.net/. Even if you have a GEOTIFF available (e.g. the freely available GeoTiffs from the NZ Topographic Authority), you cannot just upload it to your phone as the images are typically massive and would take an aeon to load and render.
  2. Use the Default World Map via in MOBAC source to scroll to view New Zealand (if you just use the NZ Topo Maps you will just see a large group of arrows with no way to navigate to New Zealand).
  3. Switch to the NZ Topo Maps Datasource in MOBAC (see http://mobac.sourceforge.net/quickstart/using3_1.htm for details). You should now see the full New Zealand topographic map.
  4. Zoom into the Area you want and mark it as a selection. As per http://mobac.sourceforge.net/quickstart/using3_3.htm
  5. Click the settings button change the Output folder to the location you want.
  6. Click Create Atlas and select your desired output mapping format (I use Alpine Quest lite which is available for free on Google Play) and all the neccessary images for your selection (at required zoom levels) will be downloaded and aggregated into the requested file format.
You now have an exported map consumable by your offline GPS application.
To consume your newly created atlas in Alpine Quest:
  1. Copy the output file (e.g. Apline Quest Map (.AQM file) to the Alpine Quest /maps directory on your Phone's SD card
  2. In AlpineQuest, click on Maps and Click Open Offline Map.
  3. You can now view your map and add waypoints as needed on your fully detailed topographical map!
GPS functions on phones are also notoriously power-hungry. Just in case, I've also purchased a couple of spare batteries and a solar charger as backup.

Auf Wiedersehen!
DDK

Monday 8 October 2012

WCF 4.5 - Host Unreachabl​e when calling a WCF service from soapUI

The WCF Test Client (WCFTestClient.exe) is Visual Studio's disappointingly basic tool for testing your WCF services. If you have your hopes up that the the Visual Studio 2012 WCF Client tool for .NET 4.5 is any better, forget about it. It is still so simple that it doesn't support client X509 Certificates or even username and passwords. Other tools like Fiddler and Wireshark are also compulsory items on the toolbelt (along with .NET coded integration unit tests). Fiddler supports client certificates out of the box and works a charm (especially for REST services).
I have used soapUI (http://www.soapui.org/) extensively for the past few years for basic integration testing of WCF (with basic endpoint bindings) and SAP web services. I've been using those also to test out connections to my current client's back-end banking systems.

soapUI isn't perfect though - as there are differences in interpretations of the WS-* standards between the Java and the .NET worlds - and soapUI is based on a Java stack. One such problem that you'll find with calling Microsoft WCF services with wsHttpBinding soapUI is that you get the following exception when you use the default settings:



    
      http://www.w3.org/2005/08/addressing/soap/fault
   
    
      
         
            s:Sender
            
               a:DestinationUnreachable
             
         
         
            The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.  Check that the sender and receiver's EndpointAddresses agree.
          
      
   

This is because there is no "To" entry in the header of the message. The fix for this is to go to the soapUI WS-A tab and ensure that the "add default wsa-To address is checked on" as per the screenshot below: