
ショコラ
住所から緯度経度を取得するには?
「Yahoo!ジオコーダAPI」を使います。
一番簡単な方法だと思います。

もっさん先輩
- 「新しいアプリケーションを開発」でアプリケーションを登録します。
https://e.developer.yahoo.co.jp/register
- 登録後に「Client ID」が作成されますので、こちらを使います。
- ジオコーディングするには以下のURLにアクセスするだけです。
https://map.yahooapis.jp/geocode/V1/geoCoder?appid={Client ID}&query={住所}
PHPのプログラムだとこんな感じで緯度経度取得できます。
<?php
$appid = '{Client ID を入力する}';
$address = '東京都新宿区西新宿2丁目8-1';
$url = "https://map.yahooapis.jp/geocode/V1/geoCoder?appid={$appid}&query=".urlencode($address);
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
];
$ch = curl_init();
curl_setopt_array($ch,$options);
$xml = curl_exec($ch);
$dom = new \SimpleXMLElement($xml);
echo $dom->Feature->Geometry->Coordinates,PHP_EOL;
// longitude 東経、latitude 北緯
[$longitude,$latitude] = explode(',',$dom->Feature->Geometry->Coordinates);
以上