I'm not sure where to put this in the forum, so I figured Theory and Questions would be fine. I have a Geometry Question that is related to a JAVA program I am making.

Ok, I am pulling a Map from online (OpenStreetMap). The query to get the online image of the map I want accepts the following parameters:

Longitiude -> Map Coordinate of Center Point

Latitude -> Map Coordinate of Center Point

Zoom -> Closeness of Image

Width -> Width (in pixels) of Desired Image

Height -> Height (int pixels) of Desired Image

Now, the user will provide the program with 2 or more coordinates. The goal of the geometry question is to retrieve a map where all of the provided coordinates are shown.

For example, the user provides:

Coordinate 1:

Longitude: 33.38

Latitude: -84.25

Coordinate 2:

Longitude: 28.25

Latitude: -81.18

The Width and Height of the Desired Map is constant. My problem is figuring out the Zoom Factor. To get the Center Coordinate, I figure I will get the largest and smallest Longitude, and the largest and smallest Latitude and average each together respectfully to get a Center Coordinate. But that doesn't help me if the zoom is wrong.

I'm unsure of too much with the zoom, but here is what I know:

Zoom Factor of 11: ~1 inch = 5km

Zoom Factor of 10: ~1 inch = 10km

Zoom Factor of 9: ~1 inch = 20km

Zoom Factor of 8: ~1 inch = 50km

Zoom Factor of 7: ~1 inch = 100km

Zoom Factor of 6: ~1 inch = 200km

Is anyone able to help me figure out some sort of formula to determine the Zoom Factor based the distance between the two Coordinates? I suspect that 1 inch on my screen is around 100 pixels, but I don't really know right now. Also, the Zoom Factor can be a double. So I guess I need to be able to do two things. 1) Turn Coordinates into Distance (miles or km) and 2) Calculate the Zoom accordingly.

Any help is appreciated. I'll provide what additional information is necessary.