Google Geocoding API v3 を用いてジオコーディング

ライセンス条項は各自で気をつけてください。この Web ページは、Google API プログラミングの練習用として載せています.

Google Geocoding API などの Google の API で取得されるコンテンツの使用条件は、Google が定めています.

各自でよく確認すること.

https://developers.google.com/maps/faq#tos_staticmaps_reuse

http://www.google.com/permissions/geoguidelines.html

関連する外部ページhttps://developers.google.com/maps/documentation/geocoding/?hl=ja

Ruby プログラム例

require "open-uri"
require "cgi"
require "nkf"

RequestUrl = "https://maps.googleapis.com/maps/api/geocode"
Key = "AIzaSyDb2yPS66kdmxOKigBES1kbHr8cgC2Y5YU"

def GoogleMapGeocode(address)
    @url = "#{RequestUrl}/json?address=#{CGI.escape(NKF.nkf("-w -m0",address))}&sensor=false&language=ja"
    json = URI.parse(@url).read
    p json 
    return json
end

json = GoogleMapGeocode("東京都庁")
p json 

第2のプログラム例

# -*- coding: euc-jp -*-
require "open-uri"
require "cgi"
require "nkf"

RequestUrl = "https://maps.googleapis.com/maps/api/geocode"
Key = "AIzaSyDb2yPS66kdmxOKigBES1kbHr8cgC2Y5YU"

def GoogleMapStreetView()
    @url = 'https://maps.googleapis.com/maps/api/streetview?size=640x480&heading=180&fov=120&location=33.59656025053064,130.21688103675842&sensor=false&key=<APIキー>'
  p @url 
    json = URI.parse(@url).read
    p json 
    return json
end

json = GoogleMapStreetView()
p json