Whenever, in the opinion of the court, it is proper that the jury should have a view of real property which is the subject of the litigation, or of the place in which any material fact occurred, it may order the jury to be conducted in a body, in the custody of a proper officer, to the place, which shall be shown to them by the judge, or by a person appointed by the court for that purpose.