Preparing routing data for pgRouting
1. It is important that you already have postgres, postgis, pgRouting installed in your machine.
A. The schema. Below is the sample schema that is a derivative of the kanagawa sample data from pgRouting. Take note of the source and target nodes, as well as the length and the node coordinates (x1,y1; x2,y2) of the line.
cybersoftbj=# \dt List of relations Schema | Name | Type | Owner --------+------------------+-------+---------- public | geometry_columns | TABLE | postgres public | roads | TABLE | postgres public | spatial_ref_sys | TABLE | postgres (3 rows)
cybersoftbj=# \d roads TABLE "public.roads" COLUMN | Type | Modifiers ------------+------------------------+----------------------------------------------------- gid | integer | NOT NULL DEFAULT NEXTVAL('roads_gid_seq'::regclass) rd_id | bigint yutu_id | integer block_id | bigint heirarchy | character varying(5) cn_name | character varying(75) py_name | character varying(100) source | bigint target | bigint x1 | numeric y1 | numeric x2 | numeric y2 | numeric costlength | numeric the_geom | geometry
A. Extracting the coordinates of the line segments from Mapinfo.
1. I have to format the data structure as follows…
…here is the roads table after weeding out some unnecessary columns…

… adding the source,target,x1,y1,x2,y2,costlength…

2. Using ObjectGeography. Download the MapBasic Reference
ObjectGeography( object, attribute )
ObjectGeography( object, “1″ ) <– gives you the beginning x coord of the point

3. Export the tab file to a shape file for ArchMap.
