LoginSignup
1
0

More than 1 year has passed since last update.

geocoder 住所からの緯度経度の算出

Posted at

開発環境

ruby 2.6.5
Ruby on Rails 5.2.5

本題

geocoder を使っていて
名称から緯度経度は算出はできるのに
住所からは算出できない問題があった

例えば

Image from Gyazo

こんなかんじ


上の記事曰く
geocoder の地図の初期設定は nominatim っていうものらしい
その精度だと住所からの算出はできないとのこと

どうやら自分は google mapAPI を使えていなかったみたい

なので

bin/rails g geocoder:config

で設定ファイルを作り

Geocoder.configure(

  lookup: :google,    

  api_key: "自身のAPIキー"              

)

で設定してやる

すると

Image from Gyazo

所得できた

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