No such order may be made for survey and inspection except in open court or in chambers upon notice of at least six days, and only by agreement of parties or upon the affidavit of two or more persons that the survey and inspection is necessary to the just determination of the suit. The affidavits shall state the facts in the case and the necessity for the survey. No such order may be made unless it appears that the party asking for the order has been refused the privilege of survey and inspection by the adverse party.
SDCL 45-4-18