Sunday, April 12, 2009

Offline OS Maps with MG Maps

I worked out how to get offline OS Maps in the UK on Mobile GMaps, and posted on the forum here.

My post:
I have worked out how to change MapTileCacher.perl (v1.35) so that you can download OS Maps from multimap.co.uk and use them offline in MGMaps. Very handy for hiking, as these are arguably the best maps in the world. I've only done this on OS X - perhaps someone can apply this technique to other OS's and other places (like within Mobile GMaps itself). 

Both 25,000:1 and 50,000:1 scales are downloaded, corresponding to the cache tool's zoom levels 15 and 14 respectively. The 50,000:1 maps are also provided at zoom levels 13 and 12, but below that you end up with pretty standard Live maps, which are handy for locating yourself, but no better than other map providers'. 

Thanks to Christian Streng's post at http://forum.mgmaps.com/viewtopic.php?t=1116&postdays=0&postorder=asc&&start=250, which set me off in the right direction. 

Firstly, you need to set the User Agent for the wget or curl fetch. If you don't, I think Multimap will 95% of the time give you a 403 forbidden response, at least it did for me. For OS X, at line 75 add a User Agent to the curl call (I don't know what you need to do with wget, I'm on OS X): 
Code:
  $wget = "curl -A Safari/3.2 -# -o TempTile.$pid "; 
  $systemRefererParam = ""; 

Secondly, put the following in place of the Osmarender map type (or your own choice of map style that you don't use). This code works out what the correct URL should be, which is a binary tile system like Live maps only broken into six digit segments. I spent a while finding the right 'miXXX' string in the middle - these combinations (where the string depends on the zoom level) give you the 50,000 or 25,000:1 maps as described above, at different zoom levels. You can zoom in further, but there is no point because you just get a blocky, scaled, version of the 25:000:1 map. (There are many other miXXX strings that give you maps for only parts of the country and/or only certain zoom levels - these ones gave me maps for all the places I tested, which wasn't all that many, but spread right across the country.) 
Code:

elsif(index($MapType,"Osmarender") != -1)     # ************ multimap for UK OS Maps ******************** 
  { 
    $digit = ((($y & 1) << 1) + ($x & 1)); # 'randomise' server access mc0, mc1, mc2 or mc3 
    $url .= "http://mc" . $digit . ".multimap.com/ptiles/map/"; 
    # the following selects the map type to use - only certain combinations of zoom and map type work, and some 
    # map numbers different from these work in some areas, but not UK-wide. Hopefully these particular ones 
    # do work UK-wide. 
    $url .= ($zoomLevel+1) >= 16 ? "mi932" : ($zoomLevel+1) >= 13 ? "mi904" : ($zoomLevel+1) >= 6 ? "mi916" : "mi915";  # select map type 
    $url .= "/" . ($zoomLevel + 1) . "/"; 
    
    # Multimap uses quadrant tiles like Microsoft Live, but splits them up into six-digit long segments. 
    # e.g. http://mc1.multimap.com/ptiles/map/mi902/16/031313/131331/311.png 
      
   $mmchars = 0; 
    for($i=$zoomLevel-1; $i >= 0; $i--) 
    { 
        # put a / every six characters 
        if ( ($mmchars == 6) || ($mmchars == 12) ) 
        { 
          $url .= "/"; 
        } 
        $url .= ((((($y >> $i) & 1) <<>> $i) & 1))); 
        $mmchars++; 
    } 
    $url .= ".png"; 
  } 


The $zoomlevel+1 business is because zoom level 15 in MapTileCacher.perl corresponds to zoom level 16 in Multimap, and so forth. 

With this you can use the cache tool, selecting the Osmarender map type, and run MapTileFE.perl as normal, but instead of Osmarender, MapTileCacher.perl will download lovely OS Maps from multimap. 

Saturday, April 11, 2009

MiniCommander J2ME for phone

It's Midnight Commander for your J2ME phone! Can unzip zip files, which is very handy for getting zipped MG Maps caches to the phone because my phone's bluetooth can't support sending folders all at once.


Friday, April 10, 2009

Offline maps with MG Maps

Huge list of software for mobile phones
 
Some interesting ones
 
http://www.basenav.com/ allows you to scan your own maps, but haven't found a use for it yet.

MG Maps 

http://www.mgmaps.com/index.php supports offline maps, works very well.

Go to the MapCacher site and choose which area you want to download by dropping pins on the map. Choose which zoom levels you want to cache. Then hit the Generate! button to download a .map file to the local system.

Execute ./MapTileFE.pl from Terminal, passing it the .map file BUT WITHOUT THE .map EXTENSION. It will call MapTileCacher.perl for each level of zoom you specify, creating a MGMapsCache folder which can be sent to the phone by Bluetooth.


Instructions on forums

Download above perl tools here.

Instructions for getting offline maps http://forum.mgmaps.com/viewtopic.php?t=725
Instructions for using offline maps here http://forum.mgmaps.com/viewtopic.php?p=2745#2745

Setup

I had to to rename the .perl.pl file to .perl, so other script can find it.

Use chmod u+x to allow execution, then just run ./MapTileFE.pl.

Monday, April 6, 2009

Word 2008 Mac Option/Control Key and navigation

By default, Word uses the option key instead of Ctrl-key like I have set up Mac to do, to go one word left or right for example (and Shift combinations). 

Found I could change this behaviour by Tools/Customise Keyboard and then changing the WordLeft and WordRight behaviours. 

Also set ParaUp and ParaDown, and their xxxExtend variants.

Removed the FileNew shortcut, and unwanted EndOfLine and 
Changed Bold to Command+N, Normal to Command+L, Italic to Command+G