The court shall not grant relief under this chapter if the court determines that exercise of the good faith improver's right of setoff under Section 741 of the Code of Civil Procedure or right to remove the improvement under Section 1013.5 of the Civil Code would result in substantial justice to the parties under the circumstances of the particular case. In determining whether removal of the improvement would result in substantial justice to the parties under the circumstances of the particular case, the court shall take into consideration any plans the owner of the land may have for the use or development of the land upon which the improvement was made and his need for the land upon which the improvement was made in connection with the use or development of other property owned by him.
Ca. Civ. Proc. Code § 871.4