You can create CartoType maps (CTM1 files) from OpenStreetMap data, ESRI shapefiles, SRTM elevation data and other sources using the makemap tool.

Download makemap, the CartoType data conversion tool

You will need the program makemap, which you can download using one of the links below

By using the CartoType makemap tool (makemap.exe, makemap_x64.exe, makemap_mac or makemap_linux), however acquired, you accept the terms of the CartoType Evaluation License and you also accept that neither CartoType Ltd, nor any owners, shareholders or officers of CartoType Ltd, or any other contributors to, authors of or maintainers of the CartoType system, are liable for any damage, direct or consequential, caused by downloading, installing or using the makemap tool, and that the makemap tool is not warranted fit for any particular use and may not be used for any commercial purpose.

The program exists in these versions:

makemap.exe for 64-bit Windows

makemap_win32.exe for 32-bit Windows (for use on 32-bit Windows only)

makemap_mac for the Macintosh

makemap_linux for 64-bit (x86-64) Linux

The current version of makemap was built using CartoType 5.4.12.

recent changes

version 7.1 CTM1 files are now created by default, in which the old tourist-bus access flag is repurposed as a pedestrian access flag
the /v command can now accept /v=7.1, which is the new default
the <file_type> element in import rules now supports plain extensions as well as wild-card filenames, for backward compatibility
it took too long to create contraction hierarchy route data
reinstated the /v command-line option to create data in older CTM1 formats (4, 5 and 6)
fixed failure to import roads that were the only component of a route relation
creating routing data that used gradients could cause a crash
some TIF files were not processed correctly if they used geographical (lat/long) coordinates in their world files
improvements to the import of postcode data
parallelized many more operations
multiple extents may be given, along with multiple output files, to create multiple maps

To uninstall the makemap tool, delete the program from your computer.

Command-line arguments

  • you can put command-line arguments in any order
  • items starting with / are options (like /project=utme) - but if the first option starts with a hyphen (-), other options must start with a hyphen, leaving you free to use items starting with / for filenames, which is useful on unix-like platforms
  • items starting with + are proj4 projection parameters
  • other items are input filenames, except for a name ending in .ctm1, which specifies the output file name (which is otherwise inferred from the first input file name)

You can use various data formats. Data formats are inferred from file extensions. Here are the main ones:

  • .osm - OpenStreetMap data (and you can use PBF data by piping the output of osmconvert to makemap: see below for details)
  • .makemap - rules for importing OSM or SHP data - affects files later on the command line
  • .hgt - USGS height data
  • .tif (if accompanied by .prj and .tfw files) - georeferenced images
  • .png (if accompanied by .prj and .pgw files) - georeferenced images
  • XX.txt - a postcode data file from geonames.org; XX is the country code

Data from several data sets can be combined into a single map: just put as many filenames as you like on the command line. 

The map data files (CTM1 files) are usable by any version of CartoType.

Automatic options

makemap does as much as possible automatically. For example, if you use this command:

makemap myfile.osm

it will automatically

  • use the options /project=m /clip=yes /route=yes /lowreslayers=yes /textindex=full /compress=as /input=coastlines.makemap
  • generate the extent of the data from the contents of myfile.osm and clip the coastlines to that extent
  • write the output to myfile.ctm1

Large maps

See also more detailed information on creating large maps.

Ordinary CTM1 files are limited to 4Gb, but if you need to create a map larger than that (you'll get an error message from makemap telling you if that's necessary) you should use the command-line option /largefile=yes. That option stores internal file positions in 5 bytes instead of 4 bytes, and thus allows files up to 2^40 bytes or 1 terabyte in size. You should use the 64-bit version of makemap when creating large files.

However, you need a lot of RAM: 64Gb to create a map of the whole of Germany or France; and makemap may take several hours to run.

Large maps can be used on all CartoType platforms.

On Windows you should always use the 64-bit version of makemap unless your computer runs 32-bit Windows. You won't be able to create files larger than 4Gb using 32-bit makemap.

PBF data

You can use PBF data as input to makemap by using the osmconvert program to translate it to OSM format. This is the easiest way to use data obtained from Geofabrik, because PBF files are even smaller than OSM files compressed using bzip2. For example, here's a Windows command line to create a map of Britain and Ireland (omitting some command-line options not needed for this example):

osmconvert64 british-isles-latest.osm.pbf | makemap /project=osgb /urbanareas=yes /extent=-15,47,7,63 /input=e:\ctm1\coastlines.makemap -.osm britain_and_ireland.ctm1

Compressed OSM data

If you have obtained OSM data in compressed form, for example as an .osm.bz2 downloaded from Geofabrik, there is no need to decompress it to a file before using it in makemap. Instead, you can decompress it to standard output using bunzip2, and send it straight to makemap without storing it anywhere. For example, the data for North America takes over 10Gb when compressed, and you probably don't want to decompress it to a file, taking up about 60Gb of hard disk space.

This Windows command line can be used to decompress to standard output and feed that data to makemap (omitting some command-line options not needed for this example):

bunzip2 north-america-latest.osm.bz2 -c | makemap /largefile=yes /extent=-180,0,-40,85 /input=coastlines.makemap -.osm north-america.ctm1

Notes:

  • The -c command-line option tells bunzip2 to write to standard output.
  • The ('pipe') operator redirects standard output to be the input to the next command, makemap.
  • Using -.osm as an input file name tells makemap to read from standard input.

Use OpenStreetMap data

This method uses data from OpenStreetMap, a organisation that is creating a world-wide street map from data collected by volunteers using GPS devices.

Download OSM files from one of the links here

or you can make OSM files for any area:

Use the Export button in the main OpenStreetMap map page. Unless the area you want is very small you'll see a message stating that the area is 'too large to be exported as OpenStreetMap XML Data'. In that case, just click on 'Overpass API':

getting osm data

Note: there is a bug (logged as ticket 5169 in the OSM issue tracker) in the script used by OSM for its Overpass query. It can cause lakes and other large polygon areas to be omitted if they overlap the bounds. If that happens (as it will, for example, when exporting greater Stockholm, Sweden), use this query, with your values for the bounds w, s, e and n:

<osm-script timeout="10000" element-limit="1073741824">
   <union into="_">
      <bbox-query into="_" w="17.8" s="59.2" e="18.3" n="59.5"/>
      <recurse from="_" into="_" type="up"/>
      <recurse from="_" into="_" type="down"/>
   </union>
 <print from="_" limit="" order="id"/>
</osm-script>

Paste it directly into the upper query box at http://www.overpass-api.de/query_form.html.

Windows

Use the command

makemap map.osm

or

makemap_x64 map.osm

This will create a .ctm1 file that can be loaded by any of the CartoType demonstration programs. As standard (you can change this using command-line options: see below) it uses the web Mercator projection.

Macintosh

On the Apple Macintosh makemap_mac needs to be run in the 'bash' shell, which can be accessed by opening a terminal window. You need to give the program executable permission before you first use it:

chmod a+x makemap_mac

then run it like this:

./makemap_mac map.osm

This will create a .ctm1 file that can be loaded by any of the CartoType demonstration programs. As standard (you can change this using command-line options: see below) it uses the web Mercator projection.

How to add coastlines to a CTM1 file

The best way is to use coastline data created by Jochen Topf, a member of the OpenStreetMap community.

  1. Get the coastlines in ESRI shapefile format from http://openstreetmapdata.com/data/land-polygons. The best file to use is the one containing complete polygons in WGS84 latitude and longitude format. (Don't use the version which splits large polygons, because the way they are split causes them to leave gaps when used in non-Mercator projections.) Unpack the files and put them in a folder called \coastlines.
  2. Create a file called coastlines.makemap as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <CartoTypeImportRules>
       <file name='..\coastlines\land_polygons.shp'>
          <commit layer='outline'/>
       </file>
    </CartoTypeImportRules>
    

  3. Run makemap with these extra options:

    /extent=<min-long>,<min-lat>,<max-long>,<max-lat> /clip=yes /input=coastlines.makemap
    

    The longitudes and latitudes for the /extent option should be big enough to enclose all the rest of your map data. The /extent option tells makemap to select only coastlines in that region from the coastline data. If you don't specify an extent, the extent is generated automatically from the bounds of the other map data.

  4. Use either of the standard style sheets provided by CartoType, or use your own style sheet and provide a style for the 'outline' layer.

If your coastlines.makemap file is in the directory you run makemap in, you don't need to specify it on the command line: makemap will notice that you haven't imported coastlines and import them automatically.

Creating route data

To create standard route data for a map, use /route=yes.

To create low-memory route data to enable routing over large areas on mobile platforms like Android and iOS, using the contraction hierarchy system, use /route=ch. Be warned that creating contraction hierarchy route data can take a long time: up to several hours for a country like the UK.

Standard routing is better if you have enough memory: if you're creating any map for a desktop computer or server, or a city map or smaller for Android or iOS. It runs faster and allows route profiles to be chosen and changed at run-time.

Using a .makemap file to control the conversion from OSM to CTM1 format

You can optionally control the way data is converted from OSM to CTM1 format, and which data is used, and which data is omitted, using an XML file containing rules. By convention such a file has the extension .makemap. You supply its name on the command line, before the names of any osm files it needs to affect, using /input=<rules file name>.

The .makemap rules language is described here.

The standard rules

The standard rules are stored by makemap. You can write them out, so that you can edit them and create a customised version, by using the following command:

makemap /writerules >standard.makemap

Importing SHP data using a .makemap file

You can import SHP data using a .makemap file like this:

<?xml version="1.0" encoding="UTF-8"?>
<CartoTypeImportRules>
 <file name='..\coastlines-complete\land_polygons.shp'>
 <commit layer='outline'/>
 </file>
</CartoTypeImportRules>

See the main documentation for .makemap files for a full explanation of how to convert the fields in each map object to your desired CTM1 attributes.

Using USGS height data (.hgt files) to create terrain

Digital height data can be obtained from more than one source. A convenient one is the United States Geological Survey, which publishes data as tiles for one-degree-square sections of the world in a simple format called HGT. Here is the site containing the data and documentation. Other sources are described, reviewed and referenced at ViewFinder Panoramas.

Disclaimer: as with all map data, neither Cartography Ltd nor CartoType Ltd nor any of its officers, directors, employees or sub-contractors take responsibility for or guarantee the copyright status or intellectual property status of this data. It is the user's responsibility to obtain permission for using data.

First download SRTM3 data covering the area you are interested in. For example, the USGS data for Eurasia is here. The files will usually be zipped and have names like N00E072.hgt.zip. Unzip them and don't change the names: makemap uses the filenames to identify the correct data. The names refer to the south-west corner of the one-degree tile. Put all the files in a single directory. In the example below, the directory name is \usgs-height-data.

Then add it to your map using the /usgs command-line parameter in the makemap tool. The format is

/usgs={<extent>,}<directory> - load USGS height data (.hgt) files for the extent from the directory given

and you can specify the extent as either three numbers, giving the OpenStreetMap map tile number in the form zoom, x, y; or four numbers, min-long, min-lat, max-long, max-lat. If you omit the extent, you can specify it earlier on the command line using /extent; if you don't specify it in either place it will be generated automatically from the combined bounds of all the other data except the coastlines.

Other parameters affecting height data are:

/terrain=height|height-feet|shadow - generate height or shadow arrays from height data; affects following files; default is shadow

/interval=n umber - interval between terrain sample points in metres; default is 250; the SRTM3 data is sampled at 90m so for this data there is no advantage in using an interval less than 90. The smaller the interval, the larger the data.

Here is an example showing how to generate a map of Greece with both height in feet and shadows. (Don't use both layers unless you are happy to incur the cost of slightly slower display and larger data.)

makemap /lowreslayers=yes /compress=a /project=m /extent=18.74,34.39,29.64,42.19 /interval=100 /usgs=\usgs-height-data /terrain=height-feet /usgs=\usgs-height-data /input=coastlines.makemap greece.osm

Notes on parameters used in the example

/lowreslayers=yes - create sets of layers for different zoom levels - speeds up map display but increases data size by about 30%.

/compress=a - compress arrays: that is, compress the array objects used to store terrain using ZLIB

/project=m - use spherical Mercator projection

/extent=18.74,34.39,29.64,42.19 - set the extent, both for getting coastlines and for terrain. These bounds in lat/long cover the whole of Greece.

/interval=100 - resample the data at an interval of 100 metres

/usgs=\usgs-height-data - specify the location of the height data (.HGT) files; this parameter creates a terrain-shadow layer, which is the default

/terrain=height-feet /usgs=\usgs-height-data - these two parameters change the terrain mode to create a terrain-height-feet layer, and reload the height data

/input=coastlines.makemap - load the SHP data for the coastlines (see above)

greece.osm - load the OSM data for Greece

Importing postal codes

Postcodes are automatically imported from OpenStreetMap data by the standard import rules. However, only a few countries like Germany have complete or almost complete coverage of postcodes in their OpenStreetMap data. Therefore it is useful to be able to import postcodes from another source. They can be obtained from the GeoNames site, which has zipfiles with names made from the standard two-letter country code, plus the extension .zip. Thus the postcodes for Austria are in the file AT.zip. This data is available under the creative commons attribution license. Each zipfile contains a file with the extension .txt: e.g., AT.txt, BE.txt, etc.

To import postcode data from one of these files, add it as an input file in the makemap command line. For example, here's a makemap command for Austria:

makemap /project=utme /urbanareas=yes /extent=9.2,46.2,17.8,49.2 /usgs=e:\new-height-data /input=e:\ctm1\coastlines.makemap /input=e:\postcodes\AT.txt austria.osm

The postcodes in a GeoNames file are points, so this data is not quite as useful as the polygon data available for Germany and some other countries, which enables more accurate geocoding; with point data, CartoType has to assume that a place belongs to its nearest postcode point, which is not always true.

GeoNames postcode data is imported into the 'postcode' layer as point objects. The postcode itself becomes the 'pco' attribute, and the place name, if any, associated with the postcode, becomes the label of the object.

Note on GB data. One of the GeoNames files for Great Britain, GB_full.csv.zip, contains the file GB_full.csv. You will need to rename it to GB_full.txt before using it with makemap.