ローカルアプリでGoogle Mapsを使ってみる

茜丸@昼勤務 | 2009年10月9日

通常、Google Mapsというものは、ウェブで使うものです。本来ローカルアプリケーションで使用するようなものではないのですし、また使う為には結構面倒くさいことをしなければなりません。ですが、そのメリットは大きく、自分 [...]

Start uga_insert_html_once: head, Footer hooked: HTML inserted: Location is HEAD Start uga_get_option: footer_hooked uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: footer_hooked (1) End uga_insert_html Ending uga_wp_head_track: Start uga_filter:

mapman通常、Google Mapsというものは、ウェブで使うものです。本来ローカルアプリケーションで使用するようなものではないのですし、また使う為には結構面倒くさいことをしなければなりません。ですが、そのメリットは大きく、自分が主につかっているAccessのようなデータベースから直接にデータを流しこんだり、連携機能を提供したりすることが可能です。今回書いてみる内容は、ウェブブラウザーコントロールを使って、Google Maps APIを仕込んだHTMLを表示させ、連携させるテクニックです。HTML側の機能を充実させれば、かなりいろいろなことができるんじゃないだろうかと思います(KML出力機能はすでに実現しているので、それを読み込んでみたりとかも面白そうだ)。

スクリーンショットの地図の部分はサブフォームで実現しており、親フォームの職員コードとリンクして動きます。サブフォームにはフォーム前面にWebBrowser Controlを貼り付け、このときのフォーム名をgooglemaps、コントロールをWebBrowser0と命名してあります。読み込むHTMLファイルは、map.htmlとし、この中には普通のGoogle Maps APIを用いて作成したコードが入っています。Mapはマップ本体と見えないですが、テキストボックスを1つ用意してあるだけです。親フォームは、給与マスタービューアという名前となっています。

まずは、フォームをロードした時のコードを記します。

Start uga_in_feed Ending uga_in_feed: Start uga_track_user Start uga_get_option: ignore_users uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: ignore_users (1) Start uga_get_option: max_user_level uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: max_user_level (8) Tracking user with level Ending uga_track_user: 1 Calling preg_replace_callback: ]*?)href\s*=\s*['"](.*?)['"]([^>]*)>(.*?) Start uga_preg_callback: Array Get tracker for full url Start uga_track_full_url: virtual.haru.gs/ge/wp-content/uploads/mapman.jpg Start uga_is_url_internal: virtual.haru.gs/ge/wp-content/uploads/mapman.jpg Start uga_get_option: internal_domains uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: internal_domains (virtual.haru.gs) Checking hostname virtual.haru.gs Match found, url is internal Ending uga_is_url_internal: 1 Get tracker for internal URL Start uga_track_internal_url: virtual.haru.gs/ge/wp-content/uploads/mapman.jpg, Start uga_get_option: track_files uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: track_files (1) Tracking files enabled Start uga_get_option: track_extensions uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: track_extensions (kmz,kml) Checking file extension kmz Checking file extension kml Ending uga_track_internal_url: Ending uga_track_full_url: Ending uga_preg_callback: mapman Ending uga_filter:

mapman通常、Google Mapsというものは、ウェブで使うものです。本来ローカルアプリケーションで使用するようなものではないのですし、また使う為には結構面倒くさいことをしなければなりません。ですが、そのメリットは大きく、自分が主につかっているAccessのようなデータベースから直接にデータを流しこんだり、連携機能を提供したりすることが可能です。今回書いてみる内容は、ウェブブラウザーコントロールを使って、Google Maps APIを仕込んだHTMLを表示させ、連携させるテクニックです。HTML側の機能を充実させれば、かなりいろいろなことができるんじゃないだろうかと思います(KML出力機能はすでに実現しているので、それを読み込んでみたりとかも面白そうだ)。

スクリーンショットの地図の部分はサブフォームで実現しており、親フォームの職員コードとリンクして動きます。サブフォームにはフォーム前面にWebBrowser Controlを貼り付け、このときのフォーム名をgooglemaps、コントロールをWebBrowser0と命名してあります。読み込むHTMLファイルは、map.htmlとし、この中には普通のGoogle Maps APIを用いて作成したコードが入っています。Mapはマップ本体と見えないですが、テキストボックスを1つ用意してあるだけです。親フォームは、給与マスタービューアという名前となっています。

まずは、フォームをロードした時のコードを記します。

Start uga_filter:

通常、Google Mapsというものは、ウェブで使うものです。本来ローカルアプリケーションで使用するようなものではないのですし、また使う為には結構面倒くさいことをしなければなりません。ですが、そのメリットは大きく、自分 [...]

Start uga_in_feed Ending uga_in_feed: Start uga_track_user Start uga_get_option: ignore_users uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: ignore_users (1) Start uga_get_option: max_user_level uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: max_user_level (8) Tracking user with level Ending uga_track_user: 1 Calling preg_replace_callback: ]*?)href\s*=\s*['"](.*?)['"]([^>]*)>(.*?) Ending uga_filter:

通常、Google Mapsというものは、ウェブで使うものです。本来ローカルアプリケーションで使用するようなものではないのですし、また使う為には結構面倒くさいことをしなければなりません。ですが、そのメリットは大きく、自分 [...]

Start uga_wp_footer_track: Start uga_get_tracker Start uga_in_feed Ending uga_in_feed: Start uga_track_user Start uga_get_option: ignore_users uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: ignore_users (1) Start uga_get_option: max_user_level uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: max_user_level (8) Tracking user with level Ending uga_track_user: 1 Start uga_get_option: account_id uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: account_id (UA-159521-2) Ending uga_get_tracker: Start uga_insert_html_once: footer, Footer hooked: HTML inserted: Location is FOOTER Inserting HTML End uga_insert_html Ending uga_wp_footer_track: Start uga_shutdown Start uga_in_feed Ending uga_in_feed: Start uga_track_user Start uga_get_option: ignore_users uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: ignore_users (1) Start uga_get_option: max_user_level uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: max_user_level (8) Tracking user with level Ending uga_track_user: 1 Footer hook was executed Start uga_get_option: footer_hooked uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: footer_hooked (1) Start uga_get_option: debug uga_options: array ( 'version_sent' => '1.6.0', 'advanced_config' => true, 'account_id' => 'UA-159521-2', 'internal_domains' => 'virtual.haru.gs', 'max_user_level' => '8', 'prefix_ext_links' => '/outgoing/', 'prefix_mail_links' => '/mailto/', 'prefix_file_links' => '/ge/wp-content/uploads', 'track_extensions' => 'kmz,kml', 'enable_tracker' => true, 'filter_content' => true, 'filter_comments' => true, 'filter_comment_authors' => true, 'track_adm_pages' => true, 'track_ext_links' => true, 'track_mail_links' => true, 'track_files' => true, 'ignore_users' => true, 'debug' => true, 'check_updates' => true, 'footer_hooked' => true, ) Ending uga_get_option: debug (1) -->