これで緯度・経度を含むデータをjson形式で取得できる。jsonのところをxmlに変えるとxml形式で取得できる。
逆に緯度・経度から住所を取得する場合はlatlngパラメータに緯度・経度をカンマで区切って渡す。
http://maps.google.com/maps/api/geocode/json?sensor=false&latlng=緯度,経度
Dim re As Object
Dim rslt() As Object
Dim url As Object
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "https?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?"
re.IgnoreCase = True
re.Global = True
Set rslt = re.Execute("google:http://www.google.co.jp/,yahoo:http://www.yahoo.co.jp/")
For Each url In rslt
MsgBox url
Next
'rsltはコレクションなのでrslt(0)という記述もOK
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function extractDate(dt) { dt.match(/(\d{4})\/(\d{2})\/(\d{2})/); return RegExp.$1 + RegExp.$2 + RegExp.$3; }"
MsgBox sc.CodeObject.extractDate("今日の日付は2011/03/18です。")
※パラメータの無い関数だと罠があった。(Office2010で確認)
sc.AddCode "function noParam() { return 'やっほ〜'; }"
MsgBox sc.CodeObject.noParam() '←何故かエラーになる
MsgBox sc.CodeObject.noParam(0) '←適当にパラメータを渡すと動く
MsgBox CallByName(sc.CodeObject, "noParam", VbMethod) '←CallByNameを使うとパラメータが無くても動く
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
この広告は180日以上新しい記事の投稿がないブログに表示されております。