これは素晴らしい!

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

参考

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

tags: zlashdot GIS Geocoding GoogleMapsAPI

Posted by NI-Lab. (@nilab)