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)....
CartoType can show terrain on a map in various different ways:
height coloring: using different colors for different heights. Colors can be blended or drawn as distinct steps. All this is controlled using a height ramp in the style sheet.
We supply a full Android Java API for CartoType which provides the same functionality as the C++ API. It contains the CartoType Java SDK as an AAR file that you can add to your project as a module (download an evaluation version).
You can also download a sample CartoType Android project, which contains the source code and project files for the CartoType Maps App, a program that displays a map using hardware graphics acceleration and allows user interaction including panning, pinch zooming, and rotation. It's provided as an Android Studio project, and also includes routing using different profiles, turn by turn navigation, finding placenames and addresses, night mode, and perspective mode. Everything's reasonably obvious except for setting the start or end of a route. To do that, use a long press on the position, then choose 'SET START OF ROUTE' or 'SET END OF ROUTE' from the alert that appears. The demo is ready to run. Just download the code or use git to clone the repository (git clone https://github.com/CartoType/CartoType-Public.git). Then load the project src/demo/android_demo/CartoTypeMaps into Android Studio, connect an Android device or simulator, and select Run 'app' from the Run menu.
Use the free Android Studio IDE for developing Android applications.
The CartoType Maps App on Android as an APK
If you'd like to try CartoType on Android without building an app, try the CartoType Maps App for Android (235Mb download). It's a pre-built version of the sample project, supplied as an APK file for you to install on your Android phone or tablet, with a map of London and the surrounding area. You can load other maps into it if you like.
By clicking on any of the links on this page or elsewhere on this web site, or by using the SDK material or demonstration programs, or source code, 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 SDK, or by any programs built using the SDK, and that the SDK is not warranted fit for any particular use and is for evaluation use only and may not be used for any commercial purpose.
The iOS SDK for CartoType allows you to use Swift or Objective C to create applications using CartoType.
A Swift-based sample CartoType project
The iOS sample project includes source code, project files, and data files including a map, style sheet and fonts. This Xcode project allows you to build a full-featured app with fast hardware-accelerated rendering, handling of user gestures for panning, zooming and rotation, routing using different profiles, turn by turn navigation, finding placenames and addresses, night mode, and perspective mode. You can set the start or end of a route using a long press. Other features are available from toolbar buttons.
To build and run the app, open the project in Xcode on a Macintosh and add the CartoType iOS SDK to it. If you are a licensee you can use your licensed CartoType SDK instead of the evaluation version; change the call to the license() function in AppDelegate.swift so that it supplies your license key. You will need to sign the app using your Apple developer certificate.
You can then run it in the simulator or on an iOS device....
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 Park House, Brampton Bryan, SY7 0DH, 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....
CartoType has functions to find addresses and perform geocoding, which is converting a position to an address. You can try out these functions using the Windows demo. Use the 'Find address' menu item in the 'Find' menu to find an address. You can fill in any of the fields. Just leave fields blank if they are not needed or the information is unknown. Searching is faster if you provide the city, state, county, or province when searching for a street address.
The makemap tool uses rules written in a small XML-based language to control the import of data from OSM and other sources. The idea is that an input data set is supplied containing a set of attributes and values (a row in the map database), and a program made up from a series of statements uses it to create one or more output map objects.
makemap uses a standard set of rules. You can write them out using makemap (see makemap's usage message for details) and edit them to create your own rules.
Thus a single input data set (database row) can create more than one map object, but the converse is not true.
The program is executed in its entirety once for each input data set....
Structure of a CartoType style sheet
<?xml version="1.0" encoding="UTF-8"?> <CartoTypeStyleSheet name="mystylesheet" background="ivory" labelAttrib="name:en"> <defs> ... </defs> <layer name="park"> ... </layer> <layer name="river"> ... </layer> <layer name="road"> ... </layer> <layer name="other-layer"> ... </layer> ... <labelLayer/> </CartoTypeStyleSheet>...
Style sheet macros and variables
Style sheets can get very big. Two ways to save space are described here.
Macros are predefined pieces of the style sheet which can be referenced by name. You define macros in the <defs> section like this:
<defs> <macro id='minor-road-label'> <label font-size='75%,8pt' glow='white' color='black' case='assume-title' maxScale='20000'/> </macro> <macro id='standard-tunnel'> <tunnel dashArray='1,1' fade='0.3' mouth='dimgrey' mouthWidth='20%,1' mouthPath='m 0 512 a 512 512 0 1 1 0 -1024'/> </macro> </defs>...
It is often necessary to enable or disable parts of a style sheet, or make them dependent on run-time parameters. While it's possible to solve the problem using several different style sheets, it is much easier to put everything into one style sheet and select different features at run-time using conditional compilation controlled by parameters set by the application.
You can select any part of a style sheet (that is, any balanced XML) using
<if exp="expression"> ... </if>...
Dimensions are specified using numbers followed by optional units. A number without a unit refers to pixels. Sometimes units are not allowed, as for example in opacity levels, which are dimensionless. Where units are allowed, you can use any of the following:
- pt: printer's points of exactly 1/72in (sometimes called PostScript points).
- pc: printer's picas of 12pt.
- cm: centimeters.
- mm: millimeters.
- in: inches.
- m: map meters; that is, meters at the scale of the map, converted to pixels using the current map projection.
- %: a percentage of some value depending on context; for example, in the context of a road, percentages refer to the width of the road, allowing you to specify that a road name is 75% of the width of the road.