| 48 | |
| 49 | Reprojecting / snapping point-geometries onto a given line-geometry using PostGIS |
| 50 | http://62.160.92.241:8066/trac/wiki/CookBook%20Postgis?action=edit |
| 51 | {{{ |
| 52 | SELECT ST_Line_Interpolate_Point( |
| 53 | line_to_project_onto.the_geom, |
| 54 | ST_Line_Locate_Point( |
| 55 | line_to_project_onto.the_geom, |
| 56 | points_to_project_onto_line.the_geom |
| 57 | ) |
| 58 | ) |
| 59 | FROM line_to_project_onto, points_to_project_onto_line; |
| 60 | }}} |
| 61 | which translates into |
| 62 | {{{ |
| 63 | {{{ |
| 64 | SELECT ST_Line_Interpolate_Point( |
| 65 | line_to_project_onto.the_geom, |
| 66 | ST_Line_Locate_Point( |
| 67 | line_to_project_onto.the_geom, |
| 68 | points_to_project_onto_line.the_geom |
| 69 | ) |
| 70 | ) |
| 71 | FROM line_to_project_onto, points_to_project_onto_line; |
| 72 | }}} |
| 73 | }}} |