LoginSignup
0
0

More than 1 year has passed since last update.

Google Maps APIで徒歩経路を取得についての備忘録

Last updated at Posted at 2022-02-16

徒歩経路を取得するパラメータ。

modeを指定すれば徒歩経路が取得出来ました。

const axios = require('axios');

const queryParams = {
  mode: 'walking',
  key: YOUR_API_KEY,
  origin: 出発地,
  destination: 到着地
};

const config = {
  method: 'get',
  url: `https://maps.googleapis.com/maps/api/directions/json?${queryParams}`,
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
0
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
0
0