LoginSignup
1
0

More than 5 years have passed since last update.

Google Maps APIを使う

Posted at
map.js.coffee
# geocoderのインスタンス化
geocoder = new google.maps.Geocoder()
# geocodeメソッドを実行
geocoder.geocode { 'address': '静岡' }, (results, status)->
    # ステータスが正しかった場合
    if (status == google.maps.GeocoderStatus.OK)
        # 緯度経度取得
        latlng = results[0].geometry.location
        # オプションの設定
        options = { zoom: 15, center: latlng }
        # マップの表示
        map = new google.maps.Map(document.getElementById('map'), options)
    # エラーが発生した場合
    else
        console.log('マップを取得できませんでした')

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0