Remove displacement on landscape edges

So I’ve tried the following to solve this:

Trying to get the world coordinate for the pixel, and then run a MOD operator on this to determine if we are at 0 or the edge. Then use LERPs to select the calculated texture, or a constant 0 value.

Not sure if I wired this correctly to get the desired effect (can’t find documentation on Fmod or If…) but it’s essentially removing all displacement.

Will keep looking into this, but appreciate any suggestions. Thanks!