In a scenery photograph, or a picture of any subject matter on more than one plane, we are representing three-dimensional space in a two-dimensional image. In order to reproduce the feeling of depth as we saw it in the original scene - depth perspective as photo people call it - we need a strong foreground object. It makes no difference what the foreground object is. It might be a tree or a bush, a rock or a person, a child's toy or a puppy dog, a car or a boat; it might be the subject of the photograph, or anything that just happens to be there. The important factor - the closer the camera is to the foreground, the greater the feeling of depth.
We sometimes take informal portraits, or photos of individual subjects in which the background or foreground is incidental. If nothing but the subject is sharp, that's okay. If everything is in focus, that fine too. But in scenery and landscape photography, maximum sharpness is important in every part of the scene, from the nearest object to the distant horizon. In order to get maximum overall sharpness, we want to select the aperture and point of focus very carefully.
The term depth-of-field refers to the distance between the nearest and farthest objects that are in sharp focus in a photograph. Typically, one-third of the total depth-of-field is in front of the point of focus, and two-thirds is behind the focus point. When taking a scenery shot, many of us point the camera at the scene and shoot. This usually results in the camera focusing on infinity. But this wastes a lot of depth perspective. Think about it. What's beyond infinity? More infinity. So if we focus on infinity, we lose two-thirds of the potential depth-of-field.
The best way of getting optimum depth-of-field is to first select a small aperture (large f/number). Next, focus about one-third of the way into the scene. To do this, select the near point and far point that you want to be sharp, then pick a point approximately one-third of the distance between the two points, focus on that point and take the picture.
Some sophisticated SLRs will find the optimum depth-of-field for you. All you do is set the camera on the depth-of-field mode, dial in the near distance that you want to be sharp, dial in the far distance, then compose the image and shoot. The appropriate aperture will be determined automatically. With other cameras, set the depth-of-field mode, find the near point that you want sharp, press the shutter release part way down, do the same with the far point, then recompose the shot and take the picture. Again, the camera will select the right aperture. If your camera doesn't have either of these features, and most of them don't, just estimating the one-third distance will be close enough.
Actually, what might be considered a small aperture is relative. If you use a 35mm or APS film camera that has aperture control, you could select f/11 or f/16 for great depth-of-field. But because of the optics in a digital lens at a given aperture, depth-of-field is much greater with digital than with a film camera. For this reason, an aperture of f/8 will usually provide enough depth-of-field with a digital camera. A smaller aperture can be used for insurance.
There are also ways of increasing depth-of-field in a photograph. One way is to use the wide-angle lens. Again, because of the optics, depth-of-field will be greater with a wide-angle lens than with a normal or telephoto lens at a given aperture. Of course, the use of a wide-angle lens is not always appropriate, but there are situations when this lens will provide the best coverage.
When photographing a large group of people, or when shooting from the sidelines at a night or indoor sporting event, you'll want maximum depth-of-field so everybody or everything will be in focus. As a review, with any camera - compact or SLR, film or digital - you can get optimum depth-of-field by focusing about one-third of the way into the scene and using as small an aperture as possible under the circumstances.
It doesn't matter how you do it. The important thing is to make sharp in a picture everything that's important in the scene.