Building codes for fences and pools vary by state, county, city, and even homeowner’s association. Codes may determine placement, height, materials, etc., so you should contact your applicable county zoning department to determine your exact requirements.