This document explains the CartoTypeRouteProfile XML format, used in .ctprofile files. These files are used to store route profiles, which are used to customize the behavior of the route calculation system. For example, it's possible to make some types of roads more or less preferable than others, or to forbid them entirely, and to set the type of vehicle, for instance to a car, heavy goods vehicle or bicycle....
Here are answers to some questions frequently asked about CartoType....
CartoType uses a standard set of map layers and attributes. These are used by the import rules built into makemap, and by the standard style sheet. You can override them completely by using your own import rules and style sheets, but it is better to use the standard set, adding new layers and attributes where needed, or omitting unnecessary ones. The reason for using the standard set is that they used by the address searching system. In general, attributes and layers are described according to how they are imported from OpenStreetMap data....
Apple introduced the Swift programming language in 2014. It has now largely replaced Objective C to become the language of choice for iOS applications. However, CartoType's iOS API is written in Objective C. This article explains how to use the CartoType iOS SDK in a Swift project. You can use CartoType completely from Swift. There is no need to write any Objective C....
There are several standard platform SDKS. This page tells you what languages they support and the files they consist of....
CartoType uses XML style sheets to control the appearance of maps. Features that can be controlled include the following:
- selection of layers
- size of features
- SVG icons
- lettering style and positioning
- scales at which features appear
You can create CartoType maps (CTM1 files) from OpenStreetMap data, ESRI shapefiles, SRTM elevation data and other sources using the makemap tool....
fast offline routing
The standard routing system, suitable for any maps on desktop platforms and servers, and city maps on mobile devices, is flexible and fast.
Route profiles tell CartoType how fast you expect to travel on different types of road, and also allow you to add weightings to indicate your preference. The free Maps app, available for Windows, Mac OS X and Linux, provides an easy way to try out different route profiles. You can choose from four standard profiles, and an editable custom profile, using the Route menu (first image below). The command 'Edit Custom Route Profile...' brings up the Route Profile Editor dialog (second image below)....
We supply a full Android Java API for CartoType which provides the same functionality as the C++ API. It contains the CartoType Java API as a .jar file called cartotype.jar, and four versions (debug and release for both ARM and x86 platforms) of the CartoType shared library, libcartotype.so. You can also download sample CartoType Java source code, which contains the source code and project files for a simple program called NavigatorApp.
Use the free Android Studio IDE for developing Android applications.
Your app will need to use the cartotype.jar and libcartotype.so libraries....
The usual way to develop apps for iOS, the operating system used on Apple's iPhone and iPad devices, is by means of XCode, a free development environment which runs on Mac OS. The 'native language' of iOS - that is, the language used for the API, is Objective C, so we provide an Objective C wrapper for CartoType.
A simple test app
You can download the source code of a simple test app which uses the CartoType evaluation library.
First get the CartoType iOS project source files.
Open the project in Xcode on a Macintosh.
Add the CartoType evaluation framework to the project.
You can then run it in the simulator or on an iOS device. The CartoType evaluation library is built for, and works on, both the 32-bit (Arm7) and 64-bit (Arm64) iOS environments.
The code is largely self-explanatory. It loads and displays a map, and allows the user to pan, zoom and rotate the map using gestures. You can create a route by clicking successively on two points It is designed as a minimal app, and therefore is deliberately very simple....
The CartoType core library is written in C++. To use it to draw maps you need to create various class objects. All CartoType functionality is accessed by calling member functions of those objects.
C++ programming conventions
CartoType class names nearly all start with C or T. C stands for 'class' or 'complicated' and is for large classes which allocate memory on the heap, and which are usually created on the heap. T stands for 'type' and is for smaller, simpler classes which are usually created on the stack. Examples: CEngine, TResult....
Expressions are used in import rules and style sheets.
Use in style sheets
They are used in <if> and <condition> elements. You write them using the exp attribute. For example:
<if exp='scale > 50000'> <condition exp='$="Italy"'>
You can use the special variables Type, OsmType and RoadType in style sheet expressions. Type is the integer type, OsmType is the same as (Type bitand #FFFE0000), and RoadType is the same as (Type bitand #FC0). For example,
<condition exp='OsmType == "cit"'><condition exp='OsmType == "cit"'>...
Building CartoType for Linux
CartoType is written in standard C++ and will compile using CLANG and GCC. Its output is a bitmap in memory, which you can display on any device if you know how your proposed device handles bitmaps. The license allows you to distribute it as part of a binary package, not as source for on-platform compilation. Linux users tend to expect binary packages, so this should not be a problem.
Using the FreeBSD operating system, a version of Unix, you can create larger CTM1 files than is usually possible under Windows, depending on how much RAM you have.
It's assumed you know how to install an operating system, so this part will be brief. You can download the latest version of FreeBSD from freebsd.org, burn it on a CD and boot from it. Make sure you download the AMD64 version, not the Intel386 as the latter is only 32-bit. The AMD64 instruction set appeared before Intel's own 64-bit processors so the 64-bit version is named for them (which must annoy Intel).
Different versions of FreeBSD ask different install questions but you can leave it to the default options selected most of the time....
In this License "You" means the individual who has downloaded the Software and/or the organisation he or she represents ("Your" and "Yours" shall be construed accordingly); "Software" means the software downloaded by You from Our website and for which you have not entered into a full SDK License with Us; and "We" are CartoType Limited. (Registered Number 7021509), registered office: at The Old Rectory, Spratts Lane, Kensworth, Bedfordshire, LU6 3RB, U.K. ("Us" and "Our" shall be construed accordingly). Other defined terms are set out below....
You can display a list of places on the map as the user enters the name, using CartoType's incremental searching support.
Create a full-text index
The first step is to create your CTM1 (map data) file using the makemap command-line option /textindex=full. That way, all phrases within text attributes are indexed, as well as the whole string.
Searching as the user types
Here's what you need to do in your find dialog....