# Finding the path between the point

I'm very new to the PostGIS and QGIS. I'm a student and I am doing thesis work on map matching.

I have segment shapefile of two network one OSM network and other one TMC network. And I have point shapefile of two networks.

Methodology to be done;

1. I need to find the closest point of OSM points to the TMC point. I have find using closet point buy using distance matrix. The distance matrix attribute table contains inputid as TMC points id and target id as OSM points id and also I also have distance between them.

2. In OSM network I don't have start and end point of the segments. How can I get start and end points of the segments?

3. And the my goal is to map TMC SINGLE LINK to OSM PATH.

For each single link between TMC POINTS, I have to find (MAPPING) which is the correspondent path (SEQUENCE OF LINKS) on OSM NETWORK, between the correspondent points OF TMC NETWORK on the OSM NETWORK. On OSM links should be attached the attribute of the link ID OF TMC ELEMENT.

For example, suppose to have the following situation:

TMC NETWORK: POINT 1: ID =500; POINT 2: ID=501; LINK between POINT 1 and POINT 2: ID = 7500

We found that on OSM NETWORK, the correspondent POINT of POINT 1 with ID =500 on TMC, is the OSM POINT 1 with ID = 12349876 We found that on OSM NETWORK, the correspondent POINT of POINT 2 with ID =501 on TMC, is the OSM POINT 2 with ID = 55532481

Now, we have to calculate, on OSM NETWORK, which is the shortest path between the POINT 1 (ID = 12349876 ) and the POINT 2 (ID = 55532481 ) on OSM NETWORK.

Suppose that we found the SEQUENCE OF LINKS (78934, 78564, 12789, 35785).

At the end, we can assume that the arch with ID = 7500 on TMC NETWORK, corresponds to the SEQUENCE of ARCHES with ID = ( 78934, 78564, 12789, 35785). So we can add to OSM ARCHES ( ID = 78934, ID = 78564, ID = 12789, ID = 35785) the attribute "TMC ARC ID" with the value: 7500.

1. Can you tell me what are procedure to be done for points 2 and 3 by using QGIS and PostGIS, pg routing. 