I am trying to geocode some OSM roads and I have created a table with a sample of 500 roads. All of the roads are multilinestrings. I have created another table using ST_DumpPoints so now I have one more table with the roads info where each entry is a single point from a single road. The 500 records from the initial sample table have turned to 48000. I would like to create a third table in which there would be three random points from a single road.
The points table:
| gid | number | path | path1 | path2 | geom | text_geom |
|-------|--------|--------|-------|-------|------|------------|
| 39559 | 49 | {1,1} | 1 | 1 | ... | POINT(x y) |
| 39559 | 49 | {1,2} | 1 | 2 | ... | POINT(x y) |
| 39559 | ... | ... | ... | ... | ... | ... |
| 39559 | 49 | {1,79} | 1 | 79 | ... | POINT(x y) |
| 15168 | Null | {1,1} | 1 | 1 | ... | POINT(x y) |
| 15168 | Null | {1,2} | 1 | 2 | ... | POINT(x y) |
| 15168 | ... | ... | ... | ... | ... | ... |
| 15168 | Null | {1,43} | 1 | 43 | ... | POINT(x y) |
Note: some entries have 1800 points to pick from. This table is just to show what it looks like.
The table I would like to have:
| gid | number | path | path1 | path2 | geom | text_geom |
|-------|--------|-------|-------|-------|------|------------|
| 39559 | 49 | {1,1} | 1 | 1 | ... | POINT(x y) |
| 39559 | 49 | {1,2} | 1 | 2 | ... | POINT(x y) |
| 39559 | 49 | {1,3} | 1 | 3 | ... | POINT(x y) |
| 15168 | Null | {1,1} | 1 | 1 | ... | POINT(x y) |
| 15168 | Null | {1,2} | 1 | 2 | ... | POINT(x y) |
| 14005 | 460 | {1,1} | 1 | 1 | ... | POINT(x y) |
| 14005 | 460 | {1,2} | 1 | 2 | ... | POINT(x y) |
| 14005 | 460 | {1,3} | 1 | 3 | ... | POINT(x y) |
Another thing worth mentioning is that all of the entries have more than three points to pick from.