It is possible to control depth of field by varying the distance to the subject and/or changing the f stop setting of the camera.
Geeky details
Further control can be done by using hyper focal focusing
When should you use hyperfocal focusing? Well, sometimes when shooting a landscape, you want everything sharp from the front to the back of the scene. Setting a small aperture such as f/16, f/22 or even f/32 can help, but if you really want to maximize depth of field, hyperfocal focusing is the technique you need to use.
To do this, you need a camera where you can switch to manual focusing and a lens inscribed with a depth of field scale
More geeky details
Hyperfocal Focusing
Detailed geeky details
Hyperfocal Focusing Details

