【问题标题】:Cannot read properties of undefined (reading 'length') at _overpassJSON2geoJSON无法在 _overpassJSON2geoJSON 读取未定义的属性(读取“长度”)
【发布时间】:2022-06-15 04:58:45
【问题描述】:

我正在尝试使用以下代码在 reactjs 中使用 Fetch API 从 openstreetmap 获取数据:

const url = 'https://www.openstreetmap.org/api/0.6/map';

const getRequestData = async (values) => {
  await fetch(
    `${url}?bbox=${values.left},${values.bottom},${values.right},${values.top}`
  ).then((res) => osmtogeojson(res));
};

export default getRequestData;

我无法弄清楚这里有什么问题,任何帮助!

【问题讨论】:

  • osmtogeojson 不喜欢您传递给它的参数。它期待什么?目前,您正在为其提供获取响应对象......这不是获取的数据。

标签: reactjs openstreetmap


猜你喜欢
  • 1970-01-01
  • 2011-11-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-29
  • 1970-01-01
  • 2015-08-10
  • 2020-09-14
相关资源
最近更新 更多