YSNHatenaBlog

主にアプリやWebサービス開発について

住所からジオコードを取得

クライアントサイドはGeocoding API使えそう。 https://developers.google.com/maps/documentation/javascript/geocoding

ライブラリ。TypeScript対応。Geocoding API対応。 https://www.npmjs.com/package/@googlemaps/google-maps-services-js TypeScript対応。Geocoding API対応。

API有効化。restrictionに設定。

403エラー。

{
   "error_message" : "API keys with referer restrictions cannot be used with this API.",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

リファラ付きだと駄目らしいので別APIキーつくる。

f:id:yosuke403:20210128062326p:plain

これで取得できた。