Except to the extent required to implement section 335.27, no ordinance adopted under this chapter applies to land, farm houses, farm barns, farm outbuildings or other buildings or structures which are primarily adapted, by reason of nature and area, for use for agricultural purposes, while so used.