Consider the following query:

WITH geoms AS(
    ST_Buffer(ST_MakePoint(10,10),5,200) as circle,
    ST_MakeEnvelope(5,5,15,15) as square
SELECT ST_Snap(square,circle,15) geom FROM geoms;

I would expect two possible outcomes:

  1. The square being made completely into a circle (points are being introduced to the segments)
  2. The 4 vertices of the square are snapped to their closest neighbours on the circle (the square would fit into the circle)

but the actual outcome is this:

square to circle

The other way around makes more sense (ST_Snap(circle, square,15)): circle to square

Here, only 4 vertices are snapped to their corresponding nearest square neigbours.

I don't understand what happens in the first case. Somebody else does? (my real use-case is more complex, but seems to boil down to this problem)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.