I am having an issue 'snapping' a points layer (be - bristol education) onto a road network (br - bristol_roads). I have created the code below using the PostGIS in Action guidebook as a reference however when I execute the code I receive this error -

  br.geom AS br_geom,
  be.geom AS be_geom,
  br.gid AS br_id,
  be.id AS be_id,
  ST_Line_Interpolate_Point(br.geom, be.geom)
  ) AS snapped_point
  FROM bristol_education AS be INNER JOIN
  bristol_roads AS br
  ST_DWithin(be.geom, br.geom, 1)
  be.id, ST_Distance(br.geom, be.geom);

ERROR:  function st_lineinterpolatepoint(geometry, geometry) does not exist
LINE 8:   ST_LineInterpolatePoint(br.geom, be.geom)
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 147

Does anyone know how I can get around this? I have tried snapping the points in arcmap/qgis but it seems that PostGIS does not pick up on this.

1 Answer 1


First, let's note that the functions are ST_LineLocatePoint and ST_LineInterpolatePoint. The signature in your query are now obsolete.

That being said, ST_LineLocatePoint takes a geometry and a point and return the fraction (line length %) of the nearest point projection on the line.

ST_LineInterpolatePoint takes a line and a fraction (line length %) and return the point located at this fraction.

In your query, it seems the two functions have been swapped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.