In the execution of an order of survey directed to him by any court, the surveyor and his assistants may, without the consent of the occupant or claimant of ownership, enter upon any lands ordered to be surveyed and to survey the same in an orderly and proper manner. Any person who shall obstruct him or his assistants therein shall be punished as for a contempt of court.