Computing center and "best" zoom level for a set of points

I need to duplicate google’s static map image API api on an internal server with no internet access. I did find OSM Wiki Page covering this topic. I initially looked at OSM Static maps API v0.3, but it was extremely cumbersome to try and get it up and running. I settled on staticMapLite since it was trivial to get up and running since it consisted of only a single .php file and a few images.

While staticMapLite does most of what I need it to do, the API it presents differs from the Google API in two critical ways - google will compute the correct center for a set of points and compute the “best” zoom level so all points are displayed.

While I am sure I could role my own code to make these computations, I am guessing that there is code out there in some library that I could simply call.

Is there?

If there is not and you can point me in the right direction for how to determine the best zoom level, I would appreciate it.

Determining a good-enough center should be easy enough ( https://gis.stackexchange.com/questions/7555/computing-an-averaged-latitude-and-longitude-coordinates ) if I need to write my own code.