Whenever the planning commission makes and certifies to the city council or to the county commission, respectively, a zoning plan, including both the full text of the recommended zoning ordinance and the maps, for the municipality or for the entire unincorporated area of the county for any militia district or land lot within the county or for land areas 500 feet wide on either side of any state or county highway or section of such highway within the unincorporated area of the county, then the city council or the county commission may exercise the powers granted to them in section 7 of this act, and for the purpose therein mentioned may divide the municipality or county or above specific portions of county into districts of such number, shape, and size as it may determine, and within such districts it may regulate the erection, construction, reconstruction, alteration, and use of buildings and structures and the uses of land. All such regulations shall be uniform for each class or kind of buildings throughout each district, but the regulations in one district may differ from those in other districts. The county commission or city council may also provide for the termination of any use of a building or structure or land that is not in conformity with the regulations of the district within which it is located (hereinafter called a nonconforming use), by specifying the period or periods in which the nonconforming use shall be required to cease, and by providing a formula or formulae whereby the compulsory termination of a nonconforming use may be so fixed, as to allow for the recovery or amortization of the investment in such nonconforming use.