Limiting movement based on screen view

I was wondering whether or not it is possible to limit the transformations of a camera based on the view in currently has. I am building something in which my orthographic camera is changing size and is moving across the x and y axis. The camera is facing a map and I want to make it so that the camera’s view never goes of the map. I have tried changing the x and y limits based on the camera size but I haven’t managed to make it work. So I was wondering if was at all possible to limit the cameras movement based on what the camera can see?
Thanks and sorry if this is ridiculously easy and I’m wasting your time.

See this answer:

 [http://answers.unity3d.com/questions/501893/calculating-2d-camera-bounds.html][1]

If you are allowing zooming, then you have to add code to recalculate minX, maxX, minY, maxY each time the orthographic size is changed.