« ALPSLABの白地図APIを使ってみる | メイン | ちず丸ぐぃ~んα版を試す »
2007年11月28日
Google Maps API の GoogleBar でお手軽ジオコーディング
これは素晴らしい!

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 は 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
参考
- Official Google Maps API Blog: Introducing... the GoogleBar!
- Google Maps API Reference - Google Maps API - Google Code
その他のジオコーダーのサンプル等
投稿者 NI-Lab. : 2007年11月28日 21:57

コメントはこちらの Ido-Batarian BBS へどうぞ。