Here are answers to some questions frequently asked about CartoType.

Will CartoType run on any platform?

Yes, as long as, for that platform, there is a way of building C++ code using a compiler which supports C++14.

Can I add my own data to the map?

Yes, you can add your own points, lines and polygons; in fact you can add any type of map object at run-time (except bitmap objects, which are used for terrain shading and similar things); objects can be added to any layer, or you can create new layers.You can add extra styles for these objects, either at run-time, or by adding them to your custom style sheet.

Why is a CTM1 file twice the size of a PBF file?

A CTM1 file is a file in CartoType's own map file format. A PBF file contains OpenStreetMap data encoded compactly using the protocol buffer system.

A CTM1 file is normally about twice the size of a PBF file. The actual main data (layer data) is roughly the same size as the PBF file, but there are several other tables necessary to make things work, or speed things up. The main ones are

  • the low-resolution layer data: when you zoom right out you don't want to incur the cost of loading detailed polygons like (say) the entire eastern coastline of the USA. The lower resolution copies remove any features which would be less than a pixel in size when drawn. Turn this off using /lowreslayers=no as a makemap argument, at the cost of slower drawing.
  • the full-text index; turn it off using /textindex=no, at the cost of poor or slow address searching.
  • the route network; turn it off using /route=no, at the cost of slow first route creation; CartoType has to build the route table at run-time if it's not in the CTM1 file.

Here's an example of how things break down, using a map of the eastern part of the US state of Virginia. I obtained the data using the ctm1_info tool, which you can download:

east_virginia.pbf = 253Mb

east_virginia.ctm1 = 424Mb

extract from ctm1_info report:

table 0: global information (166 bytes, 0.00Mb)
table 1: layer data (266637835 bytes, 254.29Mb)
table 4: projection table (99 bytes, 0.00Mb)
table 5: table of compressed strings (776336 bytes, 0.74Mb)
table 6: low-resolution layer data (41879150 bytes, 39.94Mb)
table 8: index used for text searching (57499012 bytes, 54.84Mb)
table 10: routing network (A*) (56946763 bytes, 54.31Mb)
table 12: extra information for the routing network (A*) (9493 bytes, 0.01Mb)

Can I use CartoType with Qt?

Yes. In fact our multi-platform Maps App is written in Qt, using the CartoType C++ API. The source code is availble for your use under the MIT license.

Using the CartoType Windows SDK, link your app with bin\15.0\x64\ReleaseDLL\cartotype.lib and bin\15.0\x64\ReleaseDLL\CartoTypeQtMapRenderer.lib.

Using the CartoType Linux SDK, link your app with bin/libcartotype.a and bin/libCartoTypeQtMapRenderer.a.

Please contact us if you would like to use CartoType with Qt on other platforms.

How can I set the color of a map object when I insert it using InsertMapObject()?

It's not possible to set an object to an arbitrary color, but you if you have a reasonably small set of fixed colors you can choose one using an integer attribute. For example, you can add this layer to your style sheet:

    <layer name='mylayer'>
        <condition '_c lt 1'> <shape fill='red'/> </condition>
        <condition '_c==1'> <shape fill='orange'/> </condition>
        <condition '_c==2'> <shape fill='yellow'/> </condition>
        <condition '_c==3'> <shape fill='green'/> </condition>
        <condition '_c==4'> <shape fill='blue'/> </condition>
        <condition '_c==5'> <shape fill='indigo'/> </condition>
        <condition '_c gt 5'> <shape fill='violet'/> </condition>

The color is set according to the value of the attribute _c. The underscore at the start of the attribute name prevents it from being using in text searches. To set the attribute for an object, first create a CartoType::CString object and set the attributes like this:

CartoType::CString string_attrib;

Then you can use the string in InsertMapObject:

CartoType::TResult result =