#GoogleMap #JavaScript #TypeScript
`LatLngBounds`を使って最適な中心緯度経度とズーム値を得る。
```ts
// gCoords: LatLngLiteral[]
const bounds = new google.maps.LatLngBounds();
gCoords.forEach((x) => bounds.extend(x));
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
```