It shall be lawful for the owner or owners of any real property situated in any first or second class municipality within this state to regulate and restrict by declaration or contract, as provided in § 11-5-2, the height, number of stories, and size of buildings and other structures, and the nature of other improvements to be erected or made upon property belonging to such property owner or owners, and also to regulate and restrict as to such property the percentage of the lot or parcel that may be occupied, the size of yards, courts, and other open spaces, the density of population, and the location and use of buildings, structures, and land for trade, industrial, residence, or other purposes, and to regulate and restrict upon such land the construction, reconstruction, alteration, repair, or use of buildings, structures, or land.
SDCL 11-5-1