Downloads
Stars
Version
Support Laravel 10
在專案中執行下方指令:
composer require mtsung/mapsapi
安裝好後即可在專案內使用 :
use Mtsung\Mapsapi\TwddMap\Geocoding;
在專案中有使遇到 Mysql, Mongo, Map8, GoogleMap, 都須個別配置 .env 請參照:
目前 Mongo 因為資料太多錯誤決定停止使用
Mysql, Mongo # 自行配置
MAPSAPI_GOOGLE_API_KEY="" # 圖霸 KEY
MAPSAPI_MAP8_API_KEY="" # Google API KEY
MAPSAPI_ENABLE_TWDD_MONGO=false
use Mtsung\Mapsapi\TwddMap\Directions;
/**
* Directions
*
* @param $origin
* @param $destination
* @param $mode ['driving', 'walking', 'bicycling'], default='driving'
* @return array|mixed
*/
$directions = Directions::directions('25.0097038,121.4401783', '25.0108898,121.4346963');
Source 順序:
注意事項:
use Mtsung\Mapsapi\TwddMap\Geocoding;
$geocode = Geocoding::geocode('台北市內湖區瑞光路335號');
$reverseGeocode = Geocoding::reverseGeocode('25.0396476673,121.505226616');
參數 | 型別 | 說明 |
---|---|---|
source | string | 來源: Mongo, Map8, GoogleMap |
code | int | 按照 Http status: 200 為正常 |
msg | string | 回傳說明 |
data | array | 若無資料則不回傳 Data |
trace | array | 若無追中錯誤則不回傳 trace |