« ALPSLABの白地図APIを使ってみる | メイン | ちず丸ぐぃ~んα版を試す »

2007年11月28日

Google Maps API の GoogleBar でお手軽ジオコーディング

これは素晴らしい!

GoogleBar in Google Maps API

GMap2#enableGoogleBar(); というコードを追加するだけで GoogleBar という検索窓が地図上に付く!


function initialize() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(35.185577, 136.899052), 13); // 名古屋城
    map.enableGoogleBar(); // using GoogleBar
  }
}

すごくお手軽。ものぐさには良さげ。感動。

検索窓にキーワードを入力して、
GoogleBar in Google Maps API

キーワードに合った位置へ移動できる。
GoogleBar in Google Maps API

この GoogleBar は v=2.92 で追加されている。
APIリファレンスの GMap2#enableGoogleBar の項目 には、"Enables the GoogleBar, an integrated search control, to the map. When enabled, this control takes the place of the default Powered By Google logo. Note that this control is not enabled by default. (Since 2.92)" と書かれている。

動作するサンプルを作ってみた ⇒ GoogleBar of Google Maps API : Sample of GoogleBar

参考

その他のジオコーダーのサンプル等

投稿者 NI-Lab. : 2007年11月28日 21:57

Please post your comments -> Ido-Batarian BBS
コメントはこちらの Ido-Batarian BBS へどうぞ。

« ALPSLABの白地図APIを使ってみる | メイン | ちず丸ぐぃ~んα版を試す »

人気ブログランキング - NI-Lab.'s ヅラッシュドット [Valid RSS]