我正在尝试使用带节点的立交桥 API 获取道路数据。我有:
const fetch = require('node-fetch');
const latitude = 37.7749;
const longitude = -122.4194;
const radius = 500; // radius in meters
const overpassQuery = `
[out:json];
way[highway](around:${radius},${latitude},${longitude});
out;
`;
const apiUrl = `https://overpass-api.de/api/interpreter?data=${encodeURIComponent(overpassQuery)}`;
(async () => {
try {
const response = await fetch(apiUrl);
const data = await response.json();
} catch (error) {
console.log(error);
}
})();
我得到:
FetchError {message: 'request to https://overpass-api.de/api/inter…before secure TLS connection was established', type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', stack: 'FetchError: request to https://overpass-api.d…ons (node:internal/process/task_queues:82:21)'}
我该如何解决这个问题?