当我发送坐标时,我收到一个错误响应。
我使用的是openrouteservice js库。
getResponse = async () => {
try {
const response = await Directions.calculate({
coordinates: [[9.930808,-84.052448],[9.933302,-84.056493]],
attributes: ['detourfactor'],
profile: 'driving-car',
extra_info: ['waytype', 'steepness'],
avoidables: ['highways', 'tollways', 'ferries', 'fords'],
instructions: true,
instructions_format: 'text',
preference: 'recommended',
units: 'km',
language: 'es',
format: 'json'
});
console.log(response);
this.setState({ response })
} catch (e) {
console.log(e, 'error');
}}
如果我在示例地图中放置相同的坐标,则路径工作正常,但是当我发送请求时,会得到以下响应错误:
{“错误”:{“代码”:2010,“消息”:“0超出界限:-84.052448,9.930808”},"info":{ "engine":{ "version":"5.0.1","build_date":"2019-05-24T16:27:11Z",},“时间戳”:1558719789443 }}
发布于 2022-06-15 18:45:29
不确定这是否仍然有效,但我会把这个答案留给其他有这个问题的人.
许多地理API接受纬度、经度对,但开放路线服务则接受经度、纬度。如果您将它们交换,这些位置将突然切换到完全不同的位置,如果它们恰好位于海洋或有人居住的区域之外(我的位置在南极洲),则将返回此错误消息。
不过,正如对这个问题的评论所述,也可以通过在本地版本的上使用错误的地图来获得这条错误消息。
https://stackoverflow.com/questions/56297815
复制相似问题