You will need the program generate_map_data_type1.exe, which you can download here. The program is supplied as-is and is not warranted to be fit for purpose or bug-free. It is a 32-bit Windows console application for Windows XP. It will probably run on other variants of Windows, like Vista, but has not been tested on them.
The map data files (CTM1 files) are usable by any version of CartoType except - at present - the Palm OS version, for which they must be packaged into PDB files.
This method uses data from OpenStreetMap, a organisation that is creating a world-wide street map from data collected by volunteers using GPS devices.
1. Use the OSM API (for small areas - which means areas not exceeding 0.25 degrees in latitude or longitude) or the OSM Extended API (for larger areas). These APIs allow you to request data using special URLs that contain parameters specifying the area and the type of data you want. You can enter the URL into the address line of a browser window, and the data will arrive as a web page. Save the web page to your hard disk as a file and change the extension to .osm.
2. If your file is called 'my_file.osm', use the following command line
generate_map_data_type1 /project=utm my_file.osm
This will create a .ctm1 file that can be loaded by any of the CartoType demonstration programs (except the Palm OS version, as mentioned above).
This method uses publicly available data from the US Census Dept. (But note that the current format is being phased out and a new format is being introduced in March 2008. The following method supports the old format only.)
1. Go to http://arcdata.esri.com/data/tiger2000/tiger_download.cfm and choose a US state, then press 'Submit selection'.
2. Select a county, then press 'Submit selection'. County maps are at, e.g., http://quickfacts.census.gov/qfd/maps/new_york_map.html.
3. Check the following data layers
County 2000
Designated Places 2000
Key Geographic Locations
Landmark Points
Landmark Polygons
Line Features - Hydrography
Line Features - Landmarks
Line Features - Misc. Transport
Line Features - Physical
Line Features - Rails
Line Features - Roads
Urban Areas 2000
Water Polygons
and press 'Proceed to download'.
4. When you see 'Your data file is ready', press 'Download file' and put the file in a suitable directory.
5. Unzip all the files in the directory, then unzip any zip files this process creates. This will produce files with names like "tgr12057lkA.shp". Note the 5-digit number (12057 in this example).
6. Create an XML file as follows, replacing the number 12057 with the number used in your data files (see below for an explanation of this format):
<?xml version="1.0" encoding="UTF-8"?> <DataSet Version="1.0" Name="NAME OF CITY" Copyright="unknown"> <ShpFileGroup PointFormat="degree" XAxisDirection="right" YAxisDirection="up"> <File Name="UA_12057" Layer="admin/boundary"> <Field Name="NAME" Attrib="Label"/> </File> <File Name="tgr12057lkb" Layer="railway"> <Field Name="FENAME" Attrib="Label"/> </File> <File Name="tgr12057lka" Layer="road"> <Field Name="FEDIRP" Attrib="Label"/> <Field Name="FENAME" Attrib="Label"/> <Field Name="FETYPE" Attrib="Label"/> <Field Name="FEDIRS" Attrib="Label"/> <Field Name="CFCC" Attrib="RoadType"/> </File> <File Name="tgr12057wat" Layer="water/wide"> <Field Name="LANDNAME" Attrib="Label"/> </File> <File Name="tgr12057lkh" Layer="water/narrow"> <Field Name="FENAME" Attrib="Label"/> </File> <File Name="tgr12057lpy" Layer="landmark"> <Field Name="LANDNAME" Attrib="Label"/> <Field Name="CFCC" Attrib="CFCC"/> </File> <File Name="tgr12057lpt" Layer="landmark"> <Field Name="NAME" Attrib="Label"/> <Field Name="CFCC" Attrib="CFCC"/> </File> <File Name="tgr12057plc00" Layer="place"> <Field Name="NAME" Attrib="Label"/> </File> </ShpFileGroup> </DataSet>
6. Run the program generate_map_data_type1.exe (downloadable from here).
If your xml file is called 'my_file.xml', use the following command line
generate_map_data_type1 /project=utm my_file.xml
This will create a .ctm1 file that can be loaded by any of the CartoType demonstration programs (except the Palm OS version, as mentioned above).
The file that the data conversion program generate_map_data_type1.exe reads is called the control file. Its format is as follows.
The entire file consists of a <Dataset> element. It has the following attributes, all of which are optional:
Version: a string describing the version of this data.
Name: a string that is the name of the data; usually a geographical name.
Copyright: the copyright information for the data.
Inside the <Dataset> element are one or more <ShpFileGroup> elements.
A <ShpFileGroup> encloses a group of files sharing the same coordinate format and axes. Its attributes, all of which are optional, are:
PointFormat: the meaning of point coordinates; possible values are 'degree' (Fractional degrees, using 16.16 fixed-point numbers (i.e., 1/65536 )degrees; these units are ~1.7 metres at the equator, smaller away from the equator) and 'plane' (Cartesian coordinates in metres. The projection is unknown. This format is suitable for local, large-scale data or informal mapping projects.) Other values, or no value, are taken to mean an arbitrary or unknown format.
XAxisDirection: possible values are 'true' if the x axis increases to the right, and 'false' if it increases to the left. If this attribute is missing the x axis direction is assumed to be to the right.
YAxisDirection: possible values are 'true' if the y axis increases upwards, and 'false' if it increases downwards. If this attribute is missing the y axis direction is assumed to be upwards.
The <ShpFileGroup> element contains one or more <File> elements.
Each <File> actually specifies a pair of files: a DBF file and an SHP file. Both must have the same name, given by the Name attribute, and the extensions dbf and shp respectively.
It is legal for there to be several <File> elements referring to the same pair of files. In this case, different data is extracted each time, to produce several layers from the same file.
Legal attributes are:
Name (compulsory): the base file name, without extension, used for the
dbf and shp files containing the data for this layer.
Layer (compulsory): the name of the layer; this name is used in the style
sheet to select the layer.
MappedObjectsOnly (optional): if the value of this attribute is 'true', and there are mappings in at least one of the field specifications (<Field> elements: see below), objects that are not selected by a mapping are ignored. This allows mappings to select a subset of the objects and make a layer from them.
CodePage (optional): if this is present and the numeric value of the attribute is non-zero, it is the Windows code page number for the 8-bit text in the dbf file. For example, code page 1251 is Windows Cyrillic. If the CodePage attribute is not present the text is assumed to be UTF-8. Only two code pages are supported: 1251 (Windows Cyrillic) and 1252 (Windows Latin 1).
The <File> element contains one or more <Field> elements.
The <Field> element names a DBF field and specifies the name of the object attribute it is to be converted into. It can also contain <Mapping> elements to specify a mapping between values.
Legal attributes are:
Name (compulsory): the name of the field in the dbf file.
Attrib (compulsory): the name of the object attribute this field is to become.
The Attrib value 'Label' is special. Multiple <Field> objects with Attrib='Label' can exist, in which case all the fields are selected in order, and the values are concatenated, separated by spaces, to produce the label. This special feature allows databases containing street names with prefixes ('North', 'East', etc.) and suffixes ('Street', 'Gardens', etc.) to be handled in a simple way, concatenating prefix, main name and suffix to produce a single label.
Default (optional): the default value for this field, to be used if it is not present for an object.
A field can optionally contain <Mapping> elements.
Special treatment for a field called CFCC, to support US Census TIGER data: If the field is CFCC and no explicit mappings are specified, convert the US Census TIGER data CFCC code to a number. For roads, convert to the road types specified by TRoadType in cartotype_map_data.h. For other types replace the leading letter with a number. This is a mapping of CFCC codes A00...Z99 to the numbers 100...2699.
Mappings convert specified field values to attribute values. For the moment, only integer destination values are supported; thus, each mapping maps the string value in the field to an integer attribute of a map object. The attributes are:
From: the field value to convert; a string. If <From> is absent the empty string is assumed.
ToInt (compulsory): the integer value for the object attribute. The field value is converted to this value as an object attribute.