The ctm1_info tool allows you to analyse the structure and content of CartoType maps (CTM1 files), search them for specified map objects, and get the total area or length of a group of map objects. For example, you can get the total length of all roads, list the layers in the map, or find out what type of routing data is stored.

Download ctm1_info:

ctm1_info for Windows
ctm1_info for 64-bit Linux
ctm1_info for mac OS 

This version of ctm1_info was built using CartoType 6.2.152 and uploaded on 2nd February 2021.

Latest changes:

fixes case 4809: ctm1_info can't display details of array objects
ctm1_info now renders UTF-8 correctly in Windows
--- release 6.2.152 ---


To uninstall ctm1_info just delete the executable.

By using the CartoType ctm_info tool (ctm1_info.exe, ctm1_info_mac, ctm1_info_linux or any other variant, not necessarily having one of the names listed here), 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 ctm1_info tool, and that the ctm1_info tool is not warranted fit for any particular use and may not be used for any commercial purpose without the purchase of a CartoType license.

Find out how to create CartoType maps here.

Basic use

ctm1_info

without any command-line options prints the usage message:

usage : ctm1_info { -option1 ... -optionN } <ctm1 file name>
options:
-d<layer>{,<condition>}: dumps all map objects in a layer,
optionally using a condition to select objects
-D<layer>{,<condition>}: like -d but also dumps coordinates
-a<layer>{,<condition>}: like -d but gives combined area and length of objects only
-e<W,S,E,N> or <zoom,X,Y>: applies an extent to following -d or -D options
-i: use imperial units (miles, yards, acres) instead of metric units (kilometres, metres, hectares)
-n: no tables; suppresses table information

ctm1_info <filename>

reports the tables and layers in a CTM1 file. For example:

>ctm1_info fiji.ctm1

ctm1_info built using CartoType 6.2.145

CTM1 version: 7.1
data set name: FIJI
created by makemap built using CartoType 6.2.142
copyright: Copyright (C) OpenStreetMap contributors. Data licensed under the Open Data Commons Open Database License.
projection: proj.4
proj.4 parameters: +proj=laea +lon_0=179.5 +lat_0=-18.5 +ellps=WGS84
point format: 32nds of metres
extent (map coords) (-12048444,-12513654) : (12048444,12393014)
extent (degrees) (176,-22) : (183,-15)

Tables:
table 0: global information (157 bytes starting at 57, 0.00Mb)
table 1: layer data (17,961,348 bytes starting at 214, 17.13Mb)
table 4: projection table (86 bytes starting at 17,961,562, 0.00Mb)
table 5: table of compressed strings (275,164 bytes starting at 17,961,648, 0.26Mb)
table 6: low-resolution layer data (4,225,369 bytes starting at 18,236,812, 4.03Mb)
table 8: index used for text searching (735,399 bytes starting at 25,169,615, 0.70Mb)
table 13: routing network (turn-expanded A*) (2,707,434 bytes starting at 22,462,181, 2.58Mb)

Number of layers: 25
layer 0: boundary/major, 2 map objects (1742 bytes starting at 866, 0.00Mb)
layer 1: boundary/minor, 22 map objects (12,522 bytes starting at 2608, 0.01Mb)layer 2: place/major, 36 map objects (4710 bytes starting at 15,130, 0.00Mb)
...
layer 22: map-extent, 1 map object (14,369 bytes starting at 15,930,821, 0.01Mb)
layer 23: terrain-shadow, 23 map objects (1,889,044 bytes starting at 15,945,190, 1.80Mb)
layer 24: urban-area, 14 map objects (127,328 bytes starting at 17,834,234, 0.12Mb)

Number of lower resolutions: 7

Layers at a resolution of 64 meters per pixel:
64-res layer 0: boundary/major, 2 map objects (1742 bytes starting at 18,238,441, 0.00Mb)
...
4096-res layer 24: urban-area, 14 map objects (987 bytes starting at 22,461,194, 0.00Mb)

Dumping a layer

Use -n to suppress the layer reports, and -d with the name of a layer

>ctm1_info fiji.ctm1 -n -damenity/major
ctm1_info built using CartoType 6.2.145

Layer 'amenity/major' has 100 objects:
6607864: [amenity/major,8d1a0000,run,-] lat=-17.7434 lon=-179.342; length = 913.45 m
6607902: Cicia Airport|_ele=4[amenity/major,01220000,aer,@] lat=-17.7437 lon=-179.342; area = 9.94 ha
6608023: [amenity/major,8d1a0000,run,-] lat=-17.778 lon=177.197; length = 666.19 m
6608061: Malolo Lailai Island Airport|_ele=3[amenity/major,01220000,aer,@] lat=-17.7781 lon=177.197; area = 4.86 ha
...
6616024: Vanua Balavu Airport[amenity/major,8d1a0000,run,-] lat=-17.2469 lon=-178.956; length = 1.58 km
line objects: 77; length = 35.65 km
polygon objects: 23; area = 5.35 sq km

The format of each line is:

object position in the file: this is also the object ID when loading an object by its ID
name|<attribute>|<attribute| ... 
[<layer name>,integer attribute,{optional 3-letter OSM type},type code (dot = point, hyphen = line, @ = polygon, # = array)
lat=<latitude> lon=<longitude>;
length or area = <length or area> (not applicable to point objects)

For example, the second object is

6607902: Cicia Airport|_ele=4[amenity/major,01220000,aer,@] lat=-17.7437 lon=-179.342; area = 9.94 ha

and the line can be interpreted as:

  • ID (byte offset in the CTM1 file) = 6607902
  • name = Cicia Airport
  • attribute '_ele' has the value 4, meaning the elevation is 4 metres
  • layer = amenity/major
  • integer attribute = 01220000 (hexadecimal)
  • OSM type (top 15 bits of the integer attribute interpreted as three 5-bit letter codes): 'aer', meaning 'aerodrome'
  • object type = polygon (the '@' symbol means 'polygon')
  • position in lat/long = 17.7347,-179.342
  • area = 9.94 hectares

Getting the total length or area without dumping objects

The -d option dumps all objects and prints their total length and / or area afterwards. If you just need the total length or area of a group of objects, but you don't need information on each object, use -a instead of -d. Here's how to get the total length of all roads. Note that using 'road/' as the layer selects all layers starting with 'road/'.

ctm1_info fiji.ctm1 -n -aroad/
ctm1_info built using CartoType 6.2.145

Layer 'road/' has 26,784 objects:
line objects: 26,782; length = 16112.13 km
polygon objects: 2; area = 0.21 ha

Searching using conditions

The -d, -D and -a options can all take an optional conditional expression after the layer name, separated by a comma. Conditions use CartoType's expression language. For example, find all pubs in the London area called "Marquis of Granby" (a common name):

ctm1_info london.ctm1 -n "-d*,OsmType=='pub' and $=='Marquis of Granby'"
ctm1_info built using CartoType 6.2.145

Layer '*' has 5 objects
satisfying the condition 'OsmType=='pub' and $=='Marquis of Granby'':
39327472: Marquis of Granby[amenity/minor,7d020000,pub,@] lat=51.3788 lon=-0.348923; area = 0.05 ha
39435952: Marquis of Granby|addr:postcode=KT18 7RG|addr:city=Epsom|addr:housenumber=4|addr:street=West Street[amenity/minor,7d020000,pub,@] lat=51.3332 lon=-0.270641; area = 0.01 ha
40425588: Marquis of Granby[amenity/minor,7d020000,pub,@] lat=51.4952 lon=-0.127122; area = 0.01 ha
41675824: Marquis of Granby|addr:postcode=W1T 1NR|addr:city=London|addr:housenumber=2|addr:street=Rathbone Street[amenity/minor,7d020000,pub,@] lat=51.518 lon=-0.13464; area = 0.01 ha
42733523: Marquis of Granby[amenity/minor,7d020000,pub,.] lat=51.4756 lon=-0.0358658
point objects: 1
polygon objects: 4; area = 0.08 ha

Notes:

  • The -d option is enclosed in quotes because it contains spaces. On Linux or Mac OS it's a good idea always to enclose options with conditions in quotes, because those platforms strip single quotes.
  • The layer is given as '*'; layers can include wild cards, so '*' means all layers.

Another example: find the combined area of all parks:

ctm1_info london.ctm1 -n "-a*,OsmType=='par'"
ctm1_info built using CartoType 6.2.145 

Layer '*' has 3585 objects
satisfying the condition 'OsmType=='par'':
point objects: 49
polygon objects: 3536; area = 181.06 sq km