coder's profile柯達魚PhotosBlogLists Tools Help
    April 20

    I love Google Map II

    " I love google map " 這篇網誌是我少數幾篇會被搜尋引擎相中的文章,從搜尋的keyword中發現許多網友都在找如何在Google Map 或 Google Earth 中畫圓或 整批地址 定位(地址轉經緯度)的方法。前些日子發現Google有一個Geocoder的服務,可以直接將地址轉換成經緯度,不僅如此還提供不同格式的輸出,非常好用。

    這個URL是: http://maps.google.com/maps/geo?q=地址&output=輸出型式

    兩個參數, q=地址;就是地址,中文地址也行 (真要感謝google的台灣團隊)
    output=輸出型式, 有三種 xml, json 及 csv

    例: http://maps.google.com/maps/geo?q=台北市中山北路2段50號&output=csv
    image 
    最簡單的輸出格式,直接告訴你經緯度

    例: http://maps.google.com/maps/geo?q=台北市中山北路2段50號&output=json
    image 
    json格式的輸甚至可以找出郵遞區號及行政區。

    例: http://maps.google.com/maps/geo?q=台北市中山北路2段50號&output=xml
    image
    xml格式其實就是Google Earth的kml格式,可以直接用Google Earth畫出來。


    很贊對不對?這令我靈光一現,肯定可以拿來當成地址整批定位的工具,構想是:
    (1) 用Excel,一方面大部份的使用者都會使用,拿它當成地址維護的工具再適合不過了。
    (2) Excel有一個VBA的開發環境,麻雀雖小,五臟具全,開發小型系統綽綽有餘。

    功能方面
    (1) 可以整批輸入地址(用Excel)
    (2) 可以整批進行定位(利用Google的Geocoder服務)
    (3) 提供存檔功能
    (4) 整合畫圓的功能,並可指定半徑
    (5) 可在Google Earth 裡顯示成功定位的各點
    (6) 提供Google Map的連結

    舉個例子,現在中華職棒的票都得在有ibon的7-11的店買,我住板橋,想知道有那些點有ibon,於是我上了ibon的網站,找到它們位在板橋的門市資料,整理貼到試算表GROUP1, GROUP2, ID, NAME, ADDRESS這五個欄目裡。
     image

    點選上面那個image ,會彈出下面這個對話框
    image
    再點選 [ Convert address to Latitude & Longitude ] 即可自動至geocoder取得緯度(LAT)及經度(LONG)及填入DEBUG,MAP兩個超連結。如果 Launch Google Earth after convert address 有勾選,或者直接點選 [ Google Earth ] 這個按鈕可直接在Google Earth檢視這些地址的地理位置。Draw circle for each address, Radius [      ] meters 是用來指定是否要在每個地址的方圓畫一個圓圈。[ Save ] [ Open ] 是用來儲存地址資料的,我自創了一個很笨的格式叫 alst (address list),高手不要見笑,因為我實在不會在VBA裡處理Unicode的讀寫。

    當然: 電腦裡要事先裝好Google Earth,它,令人驚嘆,完全免費
    下載URL: http://earth.google.com/intl/zh-TW/#utm_campaign=tw&utm_source=zh-tw-ha-apac-tw-google&utm_medium=ha&utm_term=earth%20download

    下面是在Google Earth的顯示樣子,不錯吧?!
    image

    再靠近一點,嘖嘖,這7-11的店還真多真密啊。(每個圓圈半徑100公尺)
    image

    回到Excel,LAT(緯度)及LONG(經度)資料填進來了。執行效率頗高,100筆地址用不到1分鐘。
    image

    事情沒有十全十美的,像第20列那個地址Geocoder就無法辦識,這時就需要一些人工的介入,好比說改一下地址格式…總之不會太難,尤其是台灣都會區的地址要訂正不難,某種程度我認為是社會進步的一個象徵,能住在這裡是一種福氣。

    我自已想了很多這方面的應用,好比說學校可以將學生或老師的地址放進來,可以了解學生或老師的地理位置分佈。連鎖店像便利商店、賣場、彩劵行,企業公司行號拿來做客戶,供應商分佈的分析…很多也很有趣。

    想試試嗎?可以從下面網址下載這個Excel,有好的建議也請留個言。
    http://cid-f2fa64914de2718c.skydrive.live.com/self.aspx/%E6%96%87%E4%BB%B6/GS3e.xls

    TODO: Web的輸出:自動產生一套Web,令這些地址可透過browser在google map上瀏覽。

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    煜庭 邱wrote:
    hihi~很榮幸有能夠拜讀到這篇文章,目前我是想要拿來做經銷點的分析。

    不過現在有一個很大的問題...出來的結果都是"610,0,0,0"

    您文章的連結直接點選也是同樣的結果,但是如果是複製貼上網址 就會是正確的

    這該如何修改呢? 感激
    Nov. 20

    Trackbacks

    The trackback URL for this entry is:
    http://coderyu.spaces.live.com/blog/cns!F2FA64914DE2718C!4376.trak
    Weblogs that reference this entry
    • None