A "viewing" means to have an open casket.
A "visitation" is when the body is laid out in the casket (which may be open or closed) before the service so that mourners may come to "visit."
A visitation offers a chance for people to "pay their final respects" to the deceased. Just as important, the visitation can be a time for mourners to meet and console each other in a more informal setting than at the funeral.
You can schedule a visitation for as little as half an hour on the day of the service, or it can last for several days before the service.
The visitation can be restricted to just close friends and family, or be open to the public. You can even have a combination of private and public hours.