MAPC2MAPC This program is designed to calibrate maps and to convert between the many calibration files in use to calibrate (ie locate on the earth) digital raster maps. It is not designed for vector maps such as used by Garmin GPS[but see below]. It will use and display maps as .jpg, .png, .bmp, .tif and .gif. It runs under Windows XP and Vista and uses the Freeimage library (inluded in the distribution). The program needs the image files to calculate bounding boxes that are needed to calibrate some systems. Menu Options: File Open Calibration : Reads a calibration file that may be .map, .gux, .tfw, .jpr, .mcd, .gmi., jgw, .pgw, .cal and .imp. The file is loaded into memory and datum or grid conversions performed. A dialogue to locate an image file may be needed; also to match datum names. A .tfw file using UTM of a Grid coordinates will also open a dialogue needing input of the zone and Datum or the GRid details. To extract a .tfw from a GEOTIFF file (.tif file with embedded georeferencing information) download FWTOOLS and run "listgeo -tfw <filename>". Will also open KML and KMZ files containing an image overlay from Google Earth-see below. KMZ files require 7-zip - see Edit. Will also open Georeferenced files using the MrSID system (.sid and .jp2). These require MrSIDDecode - see Edit File Load Map For Calibration : Loads an image file (.png, .jpr, .gif, .bmp or .tif) and displays it. Click at the top left to choose the way the file is calibrated : The Map Grid (Latitude/Longitude, OS Great Britain or UTM) and the Datum of the map (see below). Click on the map for each point and input the coordinates. For UTM and OS the Northings and Eastings are in metres (5 digits each for OS), for UTM only enter the numeric part of the zone (1 to 60). For latitude and longitude either enter whole degrees and minutes and seconds, whole degrees with decimal minutes or decimal degrees : 51 degrees 30 minutes 30 seconds OR 51 degrees 30.5 minutes OR 51.508333 degrees whichever is easier. And North/South and East/West. Between 2 and 30 points may be entered. Click at the top left to finish - you can then write calibrations and/or view the calibrated map. Right clicking on a completed calibration point allows it to be 'nudged' to an accurate position. There is a tutorial here. File Calibrate map from a file of points : Loads an image file as above then opens a file of WGS84 points (rxf,txf,mxf,plt,kml) then each click on the map is given the coordinates from that file. Particularly useful if calibrating from Google earth : draw a path, save as KML. Tutorial here. File Create Blank Map : Allows the creation of an empty calibrated map. This may be used to load track overlays without an image or to define the extent and scale of a map that will be built from others by the Merge function. The map created is equirectangular so merging a Mercator map (e.g from Google or OSM) onto it will reproject it. File Load Track Overlay : Loads a file (plt,rxf,mxf, txf or kml) of track or route points. Choose whether to put these on the map as ponts or a line and their colour. Several files may be loaded in succession. When the file is written the overlays are included. File Write Calibrations : Writes a set of calibrations, every one of .map, .tfw, .cal, .jpr, .gmi, .mcd, .txt except the input type (all types are written if an image has been calibrated). Calibrations are always written as WGS84, Latitude and Longitude. You may choose which calibrations to write in Edit>Preferences. If the program has created the map image by warping or from the clipboard then the map image is written too. File Write Overlaid Map : Saves the map with overlays a a .png and all calibrations as above. File write Trekbuddy tiles : Writes a set of tiles in a format compatible with Trekbuddy : in "<mapname>_tiles" the .map and a .set file and a SET of map tiles. Tiles are 8-bit .png whatever the input image type. If the map is in the UK then the .map file may be written using British Grid Coordinates File write Garmin Custom Map : Writes a set of tiles in a format compatible with Garmin Custom Maps : in <mapname>_tiles the doc.kml and a files folder of map tiles. Tiles are written as .jpg : other image types are converted automatically.. Use 7-zip file manager to join doc.kml and the files folder into a zip-format file with file type .kmz. The map does not need to be oriented North-South. If 'Advanced Garmin Tile Control' is checked in Preferences a form showing the tiles is opened. The number of tiles can be adjusted and individual tiles deselected (if required) by clicking. If 7-zip is installed on your machine use Edit>Locate 7-zip to 'Open' 7z.exe and the program will invoke it automatically. The 'tiles' need no further georeferencing. There is a sample map here - thanks to the Libra Map project for the map. File Write Mobile Atlas : Writes one or more sets of tiles for Andnav or Maverick applications. These use the Google Earth standard spherical Mercator projection with zoom levels where level 0 is the whole earth in one 256x256 tile, level 1 is 4 tiles, level 2 16 tiles and so on up to about 17 with tiles numbered south and east from a point north of the Bering Strait. The program calculates the nearest matching zoom level and offers a range. Each zoom level is displayed on screen with the option to save space by deleting tiles (e.g water in the centre of a lake) and each deletion is inherited by the next zoom level. The map has to be reprojected to the spherical Mercator projection - this process may take a few minutes. File Exit : Saves any settings and exits the program (settings are not saved if the close window icon is clicked) View Calibrated Map : Opens the image file in a new window and, as the cursor moves within it, shows the calibrated position as Latitide and Longitude and as UTM or (in Britain) British Grid. Note that these are always WGS84 (except for the British Grid) and if the map grid is based on a different datum then there will, of course, be a difference. The map is intitially fitted to the available screen but may be zoomed to full size ('Fit' and 'Full' buttons) and panned Up, Down, Left or Right. Calibration points are shown as red crosshairs and their position may be adjusted by right-clicking; closing the window then causes recalculation of the calibrations. A centre button click can be used to add a calibration point - close the window to recalculate. Merge Maps : see www.the-thorns.org.uk/mapping/MAPMERGE.pdf Edit Preferences : Allows a warning to be issued before an output file is overwrittten. : When creating a .tfw file from only two calibration points, the default is to rotate the map. A preference allows you to stretch the map instead. This may be needed if whatever is reading the .tfw file needs the 2nd and 3rd lines to be zero. : When reading a .map, .jpr or .tfw file that is not WGS84 will write a WGS84 version : Size of tiles when tiling maps : Whether to show a WGS84 latitude and longitude grid on calibrated maps : Set the DrawOrder and JPG quality for Garmin maps : To enable advanced tiling for Garmin : more control over tile sizes and ability to selectively remove tiles from the output KMZ file (eg a map of an island with areas of sea that are not needed) : To select which calibration types are to be written Edit Locate Datums File : Opens a dialogue box to allow an alternate datums.txt file to located and used Edit Locate 7-Zip Program : Opens a dialogue box to locate "7z.exe". If this is done, 7-Zip will be invoked by the program to create the .kmz file for Garmin Custom Maps Edit Locate MrSIDDecode : Opens a dialogue box to locate "mrsiddecode.exe". If this is done, mrsiddecode will be invoked by the program to decode MrSID .sid and .jp2 georeferenced files into a .tif and .tfw. MrSIDDecide can be downloaded from here. Edit Rescale map and save : Choose a percentage (10-90) by which to rescale the map; the image is saved as a 8-bit .png and calibrations of all types are saved to match the rescaled map.The names are suffied by the scaled fatctor so 'map1' at 40% becomes 'map1_40'. Edit Crop Map and save : Choose an area to crop (left click for top left, right click for bottom right) and the map and matching calibrations are saved as above. The names are suffixed by '_cr'. After rescaling or cropping the (new) calibration file must be loaded to see the new map. Edit Warp map to Lat/Long or Rotate Map to North : If the original calibration was not a simple equirectangular Latitude/Longitude then this function (which may take some time to process) will reproject the map to an equirectangular one. If the map covers a large area and is not based on a simple projection then, in its original form, an exact Garmin custom map may not be created. As pixels are being resampled some loss of quality is inevitable. As part of this process the map will be oriented to the north. A map with straight grid lines and curved latitude/longitude lines will now have straight latitude/longitude and a curved grid. For a map calibrated as a simple equirectangular Latitude/Longitude then this function rotates the map to point north. Edit Fit Coordinates : A common occurence is to have a map that was drawn to a projection that is not equirectangular but latitude/longitude is the only calibration information. As part of the loading proccess the program displays the 'Average projection error in simple TFW' showing how far away the calibration appears to be from the original (For more details, see here) . If you know the original projection then this function calculates the best fit coefficients for that projection. For example, for a UTM map it will calculate the UTM northings and eastings of the calibration points. If you do not know the projection but have at least seven calibration points then this function can calculate a polynomial best fit. The best fit coefficients will then be used when creating a Garmin Custom Map or will be saved in a specific format in a .p2p file for later use. Or, they can be used with the Edit Warp function to reproject the map. Edit Revert Fit will undo this process. Edit Write OS Datum .MAP : Write a .MAP file based on the OS Datum for use with Trekbuddy Edit Remove Datum Match : When you have matched dateum names, the latest match is remembered. If you need the program to forget the match, click this. Datums From version 2.2.3 the package contains a full set of datums. This is by kind permission of Alan Murphy, author of GPSU (www.gpsu.co.uk) - a program that is recommended for managing tracks and routes and interfacing with GPS units. If the Datum has a different name to the one by which GPSU uses (e.g "NAD 27" instead of "NAD27" there is the option to match to a known datum; the latest match is remembered and re-used without prompting. Grids The program understands UTM, British and Irish grids as well as Latitude and Longitude. Also the DutchRD and Swedish RT90 grid. Others will be added subject to demand. Grids are held in m2grids.txt and can be edited if you feel confident. The program 'understands' UTM and Lamber Conformal Conic grids (as used for many US states) Calibration points Different systems require different numbers of points. This program never reduces the number of points but will add one or two if necessary. An exception is the TFW format which is a mathematical description of the calibration (the coordinates of the top left and four scale factors). More details here. If the map is aligned with its grid then two of these scale factors are zero. Several calibration points may be used if the map has curved grid lines or is a Mercator projection but the TFW format always assumes the map is 'square' : an Equirectangular projection. For walking maps this does not cause a major error but for large areas the TFW format will, by its nature, be innacurate. The TFW format is used internally for the 'View' function, except for maps with a Mercator projection. Input files .gux files are accepted with 2,3 or 4 calibration points in degrees, degrees/minutes, degrees/minutes/seconds, UTM or British grid .map files are accepted with calibration points in degrees and minutes or UTM .tfw files may be in latitude and longitude or UTM. Sometimes Ozi may write incorrect UTM .tfw files with a negative origin, these are rejected. KML/KMZ Files. These files consist of one or more images that can be or have been overlaid on Google Earth. If the files has been created by a program that tiles the images and obtains coordinates from a calibration file then the program will join the adjacent images into a single one and compute calibrations from the input. If the images have been placed manually, overlap or have different scales then a slower process that maps pixels has to be used. If your image needs this to be done then check 'Generalised (but slower) build image from KML/KMZ' in Edit>Preferences. In either case, the built image needs to be saved before further processing. If you have an active internet connection then images referenced by URLs will be loaded. Size Limitations There are no pre-set size limits. The size of maps that can be handled is dependant on free memory. The program tries to convert any image to full-colour (24 bits per pixel) but will attempt to continue if this cannot be done. If an image is a .jpg or full-colour .tif or .png and cannot be loaded then try using an imaging program (e.g Photoshop Elements or GIMP) to convert the image to palettised form with less than 256 colours. Some functions such as Map Merge always require space for full colour and two or three copies of the image. Freeimage will fail to cope with an image which cannot be address in 31 bits : equiavelent to 25000x25000 pixels. File associations MAPC2MAPC does not make any file associations - to open a file run the program and use File/open or File/load map Back to the download page Please report problems to calfiles -at- the-thorns.org.uk Changelog: version 0.0.1 26 November 2008 First version version 0.0.2 3 December 2008 Correct handling of input UTM on NAD27 version 0.0.3 January 2009 Lat/long display options, TIF image file, stretch or rotate, write wgs84 version of input version 0.0.4 January 2009 Allow Southern hemisphere UTM TFW files, better zone selection, reject invalid TFW files. accurate view for Mercator projections (e.g Google or Open Street Map maps from gmapmaker) version 0.0.5 February 2009 Allow reading MCD files (OS version only ex Get-A-Map) version 0.0.6 February 2009 Allow leading spaces in TFW files (ex LISTGEO) and OS TFW files; fix locale problems version 0.0.7 February 2009 Add output .txt files for Tracky version 0.0.8 April 2009 Fixes for OSM-MAP .map format version 1.0.0 July 2009 Zoom and Pan Map; Allow calibration of images version 1.0.1 fix read non-OS MCD version 1.0.2 check invalid OS references when calibrating version 1.0.3 Replace GDI+ with Freeimage; show calibration points as red crosshairs version 1.0.4 Write Trekbuddy style tiles, too version 1.0.5 Crop and rescale maps version 1.0.6 Rebuild bitmap palette when tiling version 1.0.7 Better crop for Mercator maps, redesign crosshairs, nudge calibrations version 1.0.8 Stop memory leakage; restructure for better calibration; save inner points when cropping; parse .map version 1.0.9 Best fit calculation for tfw file from 3 or more points, 'nudge' existing calibrations version 1.1.0 Use right mouse button to scroll half a screen, crop bug fixes version 1.1.1 Optionally show grid (based on TFW) when viewing calibrated maps. version 1.1.2 Allow image to be loaded from clipboard, minor bug fixes version 1.1.3 Handle tiny .map files from gm2tb; fix errors when calibrating not WGS84 version 1.1.4 Option write in a format for Garmin Custom Maps version 1.1.5 Fix memeory leakage; OZI MAP files for Irish Grid; file name dialogues when cropping or rescaling version 1.1.6 Option to invoke 7-Zip file manager for creating KMZ files for Garmin Maps version 2.0.0 Incorporate MapMerge functionality; fix a bug with non-WGS84 UTM coordinates;JGW and PGW input version 2.0.1 Handle more .cal formats; handle files with line feeds only; adjust tiles for Mercator projection for Garmin; handle Mercator projections when merging; configure DrawOrder and JPG quality; don't pack JPG in KMZ; remind to save preferences on Exit version 2.0.2 Advanced tiling for Garmin maps - see preferences version 2.0.3 Count Garmin Tiles; read IMP files ex CompeGPS version 2.0.4 Switch for KMZ transparency version 2.0.5 Bug fixes for MAP and CAL files version 2.0.6 Bug fixes for files without CRLF and UTM MAP files version 2.0.7 Load track overlays version 2.0.8 Colour picker and allow PLT overlays version 2.2.0 Create blank map; calibrate with other grids; tile size warning; JPEG subsampling version 2.2.1 Correct OS map for Trekbuddy version 2.2.2 Allow OS Datum .MAP to be written separately version 2.2.3 Correct MM1B calculation for .MAP; include full set of Datums version 2.3.0 Up to 5000 tiles, selective output of calibrations, internal restructure to improve accuracy, continue with limited function if image too large, p2g file, 200% zoom, Lambert Conformal Conic projections/grids I have also been restructuring some of the internals. Up to version 2.2.4, everything was converted as soon as possible to WGS84 latitude and longitude. Whilst this was good for the program's original objective of converting calibrations, it did mean that if the map being handled was based on a grid (such as OS or UTM) then some errors were introduced. So I am now carrying the original grid information forward to the routines that merge maps and write 'tiles' for Trekbuddy or Garmin. This should improve accuracy. If you calibrate a map with the program or merge maps this original grid information is saved in a format like a world file with file type 'p2g'. The program will open this like any other calibration file. If the calibration does not appear exact then the program now suggests which point appears to have the greatest deviation. version 2.3.1 Use Freeimage 3.13 version 2.4.0 Read KML/KMZ files The ability to read these files means that Google Earth becomes a (almost) univeral map calibrator. Fit any map as an image overlay and save as a KMZ; MAPC2MAPC will produce a set of calibration files for use with OZI,Memory-map, Trekbuddy etc. If you want a Garmin custom map then MAPC2MAPC will cut it into tiles. version 2.4.1 Handle Swiss Grid; Reconstruct a whole image from tiled KML/KMZ files; scroll bars on view screen version 2.4.2 Allow choice of methods for building an image from KML/KMZ files version 2.4.3 Delete temporary files from KMZ URLs; bug fixes version 2.4.4 Fix Basecamp import problem version 2.4.5 Allow French grids zones I to IV, Map warp function (see Edit, above) version 2.4.7 Bug fixes, Fit Coordinates and Rotate Map (see Edit, above); will also handle larger files. Merge transparency threshold. version 2.4.8 More Help information, read track files as KML version 2.4.9 Use MrSIDDecode to decode .sid and .jp2 files; .csv calibration file output; allow world files in feet or metres; zoom to full size when cropping. version 2.5.0 Fix UTM TFW bug; dashed overlays; Garmin tile calculation fix; Point delete bug fix version 2.5.1 UTM southern Hemisphere, thumbnails when calibrating, fix merge cropping, faster merge version 2.5.2 Write Mobile Atlas - Andnav, Maverick version 2.5.3 Bug fixes - UTM Calibration and Thumbnail view version 2.5.4 Improved Quadratic Fit algorithm; keep maps as 8-bit where possible to save space, CAL merc lon fix version 2.5.5 Add OSMtracker atlas format version 2.5.6 Mobile atlas output directly to device version 2.5.7 Albers Projection, TIF info, tighter validation, Mercator calibration version 2.5.8 Allow multiple maps to be merged without saving/reloading Garmin vector maps can be converted to raster maps with cgpsmapper which will create a .bmp file and a matching .map file. MAPC2MAPC will convert this .map file as above. ==================================================================================================== Some Vista users may receive an error : 'Component COMCTL32.OCX or one of its dependencies is not correctly registered' The following has solved it for another user : type regsvr32 -u comctl32.ocx in run then install this app http://www.ascentive.com/support/new/libraryfiles.exe This may also happen for MSINET.OCX : open cmd in administrator mode and type : regsvr32 msinet.ocx ==================================================================================================== This software uses the FreeImage open source image library. See http://freeimage.sourceforge.net for details. FreeImage is used under the FIPL, version 1.0 |