Generating routing data

From MSM_Wiki
Jump to: navigation, search

What is routing data?[edit]

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?[edit]

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.


Using GPSMapedit[edit]

You need to go through 3 steps to generate routing data and ensure no error.

  1. Generate Routing Nodes - go to Tools -> Generate Routing Graph -> Using Coinciding Nodes
  2. Assign default road parameters - go to Tools -> Fix Routing Attributes for Roads
  3. Check for errors - go to Tools -> Verify Map
    1. You need to ensure that there is no self-intersecting road, misaligned node and nodes too close
    2. Check the appropriate boxes and click Start. GPSMapedit will verify your map and list the errors
    3. Fix all the listed errors
  4. Your map is ready for compilation


Using Maproute[edit]

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[edit]

Before you take the next step, remember to "remove routing nodes" in your .mp file while in MapEdit. Otherwise, compilation at MapCenter2 will fail.

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

Running Maproute[edit]

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/tutorials/MapRef/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.

Preparing build.mp[edit]

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/tutorials/MapRef/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.

If you wish to compile your map at MapCenter2, you should create a zip file containing the processed shp files as well as the Build.mp. The resulting zip file (in this example, named "MyMap.zip" is what you will need to upload to MapCenter2. WARNING: The original filename.mp file you worked on is no longer required and MUST NOT be included as it will cause failure to compile.

If you are also creating a Mapset at MapCenter2, you should also include a pv.txt file.

http://i28.photobucket.com/albums/c223/kcloh/Misc/shpfiles.png

You can now proceed to compile your map.

Additional Reading[edit]

Rotweiler's Autorouting Guide