Generating routing data
What is routing data?
For a routable map to work even decently, routing data have to be prepared. This data includes:
- Road traffic properties such as speed limit, one way flag, etc
- Intersection properties such as node IDs and turn restrictions
Prior tutorials on road intersections, One way streets, routing parameters and turn restrictions already got newbie mappers started on preparing routing data. All that is left is the automatic creation of all intersection nodes and error checking.
There are two very distinct way to generate routing data. One is via GPSMapedit and the other using the Maproute program.
Generate routing data using GPSMapedit or Maproute?
Not too long ago, using Maproute was the only to generate routing data. Therefore most mappers of amateur mapping community still uses this method. This method is however quite complicated.
GPSMapedit now gives us an alternative to using Maproute. It is much more straight-forward and intuitive. It is recommended to use GPSMapedit to generate routing data.
You need to go through 3 steps to generate routing data and ensure no error.
- Generate Routing Nodes - go to Tools -> Generate Routing Graph -> Using Coinciding Nodes
- Assign default road parameters - go to Tools -> Fix Routing Attributes for Roads
- Check for errors - go to Tools -> Verify Map
- You need to ensure that there is no self-intersecting road, misaligned node and nodes too close
- Check the appropriate boxes and click Start. GPSMapedit will verify your map and list the errors
- Fix all the listed errors
- Your map is ready for compilation
Maproute accepts only data in ESRI shapefile format. To use Maproute, your map data needs to be converted to shapefiles and feed into Maproute which would generate the routing data. After that, you will need to configure another special mp file to combine all data again. Complicated huh?
Convert to shapefile
To convert your map data to shapefiles, use the following command:
cgpsmapper shp filename.mp
Files will be generated based on the table below. There will also be files with names starting with marine...These files will be empty if there is no marine objects in your map and can be ignored.
|Object Class||Files Created|
|Polyline||line.dbf, line.shp, line.shx|
|Point (POI)||poi.dbf, poi.shp, poi.shx|
|Point (Indexed City)||point.dbf, point.shp, point.shx|
|Polygon||polygon.dbf, polygon.shp, polygon.shx|
You need to prepare a maproute configuration file for Maproute to be able to recognise the data fields in your shapefiles. Here is a sample: http://www.malsingmaps.com/antyong/tutorials/maproute.ini
You can also use the maproute.ini file that comes with the Maproute program.
The command to run Maproute is as below:
Maproute maproute.ini 39
4 files will be created by Maproute:
- processed_line.dbf, processed_line.shp & processed_line.shx form a set of shapefile for the road polylines with routing parameters
- processed_segments.dbf is the routing data
If you intend to compile your map at Mapcenter2, remember to include these files in your archive.
Your map and routing data is all in the form of shapefiles. You need to prepare a special mp file command cgpsmapper to import these shapefiles. We usually name this mp build.mp. Sample: http://www.malsingmaps.com/antyong/tutorials/Build.mp
The Dictionary section within build.mp controls the zoom level of each object type. Understanding and configuring the dictionary section is however among the most confusing part of the whole mapping process. If you wish to know more, please refer the the cgpsmapper manual.
You can now proceed to compile your map.