Google Maps v3 でデフォルトの拡大率を指定する方法を教えてください。次のサンプルを参考にGoogle mapを実装しましたが、コード中のどこにどのようにデフォルトの拡大率を指定すればよいかわかりません。 http://japonyol.net/editor/v3metro.html どうぞご教授お願いいたします。

回答の条件
  • 1人5回まで
  • 登録:
  • 終了:2012/10/30 07:30:04
※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。

回答2件)

id:a-kuma3 No.1

回答回数4973ベストアンサー獲得回数2154

ポイント50pt

こんな感じ。

    var myOptions = {
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            zoom: 5     /* ★コレ! */
        };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

API のリファレンスを見るべし。
https://developers.google.com/maps/documentation/javascript/reference#MapOptions

他3件のコメントを見る
id:a-kuma3

マーカーが地図内に入るように、調整されてるんですね >fitBounds()

fiwa さんが、ポイントにこだわってないのは知ってますが、新しい回答として書いた方が、質問者にとって見やすいんじゃないか、と。

横からすいません。

ぼく、こういうやりとりは、大好きです。
# 回答者として、うかつだから、というのは脇に置いといて...

2012/10/23 21:35:26
id:fiwa

いやコピペ回答が長くって、回答ボタンが遠かったので、つい (^^ゞ

2012/10/23 22:10:45
id:sanada33 No.2

回答回数293ベストアンサー獲得回数3

ポイント50pt

Properties

Type

Description




backgroundColor

string

Color used for the background of the Map div. This color will be visible when tiles have not yet loaded as the user pans. This option can only be set when the map is initialized.



center

LatLng

The initial Map center. Required.



disableDefaultUI

boolean

Enables/disables all default UI. May be overridden individually.



disableDoubleClickZoom

boolean

Enables/disables zoom and center on double click. Enabled by default.



draggable

boolean

If false, prevents the map from being dragged. Dragging is enabled by default.



draggableCursor

string

The name or url of the cursor to display on a draggable object.



draggingCursor

string

The name or url of the cursor to display when an object is dragging.



heading

number

The heading for aerial imagery in degrees measured clockwise from cardinal direction North. Headings are snapped to the nearest available angle for which imagery is available.



keyboardShortcuts

boolean

If false, prevents the map from being controlled by the keyboard. Keyboard shortcuts are enabled by default.



mapMaker

boolean

True if Map Maker tiles should be used instead of regular tiles.



mapTypeControl

boolean

The initial enabled/disabled state of the Map type control.



mapTypeControlOptions

MapTypeControlOptions

The initial display options for the Map type control.



mapTypeId

MapTypeId

The initial Map mapTypeId. Required.



maxZoom

number

The maximum zoom level which will be displayed on the map. If omitted, or set to null, the maximum zoom from the current map type is used instead.



minZoom

number

The minimum zoom level which will be displayed on the map. If omitted, or set to null, the minimum zoom from the current map type is used instead.



noClear

boolean

If true, do not clear the contents of the Map div.



overviewMapControl

boolean

The enabled/disabled state of the Overview Map control.



overviewMapControlOptions

OverviewMapControlOptions

The display options for the Overview Map control.



panControl

boolean

The enabled/disabled state of the Pan control.



panControlOptions

PanControlOptions

The display options for the Pan control.



rotateControl

boolean

The enabled/disabled state of the Rotate control.



rotateControlOptions

RotateControlOptions

The display options for the Rotate control.



scaleControl

boolean

The initial enabled/disabled state of the Scale control.



scaleControlOptions

ScaleControlOptions

The initial display options for the Scale control.



scrollwheel

boolean

If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.



streetView

StreetViewPanorama

A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped.



streetViewControl

boolean

The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (e.g. a non-Earth map type).



streetViewControlOptions

StreetViewControlOptions

The initial display options for the Street View Pegman control.



styles

Array.<MapTypeStyle>

Styles to apply to each of the default map types. Note that styles will apply only to the labels and geometry in Satellite/Hybrid and Terrain modes.



tilt

number

The angle of incidence of the map as measured in degrees from the viewport plane to the map plane. The only currently supported values are 0, indicating no angle of incidence (no tilt), and 45, indicating a tilt of 45deg;. 45deg; imagery is only available for SATELLITE and HYBRID map types, within some locations, and at some zoom levels.



zoom

number

The initial Map zoom level. Required.



zoomControl

boolean

The enabled/disabled state of the Zoom control.



zoomControlOptions

ZoomControlOptions

The display options for the Zoom control.

コメントはまだありません

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません