Often with landscape photography, the goal is to capture your scene completely sharp from front to back in order to show the maximum amount of detail. This is called maximum depth of field. To achieve this, you need to set a narrow aperture (high f number). The examples above demonstrate the difference between shooting a landscape with a wide vs narrow aperture.
In the first image here, an aperture of f/4 was used. The tree in the foreground is sharp, but the scene beyond is soft. In the second frame, a narrower aperture of f/16 records both foreground and background more clearly. If the aim is to single out a key feature of the landscape, a wide aperture can be very useful, but most of the time a narrow aperture and maximum depth of field is preferable. An easy way to set your aperture for landscapes is to use AV mode, then dial in a narrow aperture like f/16. Watch the shutter speed – if it drops too low you may need to use a tripod or increase your ISO to avoid blurred images.
For the sharpest landscapes, you also want to be shooting at the 'sweet spot' of your lens. A general rule of thumb is that your lens is sharpest at two f-stops from your widest aperture setting. So if using a lens that is f/2.8 at its widest setting, your sweet spot on that optic will be around f/5.6.
A common problem for landscape photographers is that you can focus on something in your foreground but risk everything behind it being soft. Conversely, if you focus on elements in your background, your foreground is blurry. Hyperfocal distance focusing helps you get more of your frame sharp by finding the closest point at which you can focus and keep your background acceptably sharp. This technique isn't as complicated as it sounds, and the Depth of field (DOF) and Hyperfocal distance calculator on the Photo Companion app does all the hard work for you.