By default, google offers this example of how to center a map on Chicago, IL:
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
Is it possible to have the default center focus on the entire United States? I can't find this anywhere.
The Geographic Center of the Contiguous United States is located about two miles northwest of Lebanon, Kansas. A small stone pyramid marks the point measured by a survey performed in 1918.
Midwest, also called Middle West or North Central States, region, northern and central United States, lying midway between the Appalachians and Rocky Mountains and north of the Ohio River and the 37th parallel.
The Geographic Center of the Lower 48 States is located north of Lebanon, Kansas. It was determined by finding the center of gravity for the contiguous United States, that is, the point at which a plane map of the 48 states would balance if it were of uniform thickness.
Use Chicago as the center, and then change the zoom
.
There's an example here. A slightly reworked version (untested!):
gMap = new google.maps.Map(document.getElementById('map'));
gMap.setCenter(new google.maps.LatLng(41.850033, -87.6500523));
gMap.setZoom(ANewZoomLevel);
You'll need to experiment to find the right zoom level for your needs.
Use the Geographic Center of the Contiguous United States:
Lebanon, Kansas. Probably the most boring place on earth.
http://www.kansastravel.org/geographicalcenter.htm
I find that a zoom of 3, 4, or 5 is perfect.
gMap = new google.maps.Map(document.getElementById('map'));
gMap.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
gMap.setZoom(3);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With