In an attempt to join two rasters with a very small offset, the join on ST_ClosestPoint geometry column is logical to me:

SELECT s.geom, s.val, c.val
JOIN c ON ST_ClosestPoint(s.geom , c.geom) = s.geom

But this does not return any results.

(PostGIS v2.2.1 and PostgreSQL v9.5)

  • Perhaps try with ST_SnapToGrid, the raster version, and use ST_Intersects for the join condition? Commented Aug 25, 2016 at 11:30
  • what is an example of the actual geometry of s.geom and c.geom? eg: 'POINT(-90.3928339896896 36.7569372904341)'
    – kttii
    Commented Aug 25, 2016 at 13:23

1 Answer 1


ST_ClosestPoint returns an actual point, not a boolean as would be needed for a JOIN.

See also PostGIS: ST_ClosestPoint join error

Your Answer

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

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