【问题标题】:select ways as nodes with way center as node coords选择路径作为节点,路径中心作为节点坐标
【发布时间】:2015-06-11 17:36:54
【问题描述】:

如何选择路径作为节点,路径中心坐标作为节点坐标?

目前我的查询如下所示:

[out:json];
way
  [amenity=drinking_water]
  ({{bbox}});
out center;

我的数据如下所示:

{
  "type": "way",
  "id": 123,
  "center": {
    "lat": 1.23,
    "lon": 4.56
  },
  "nodes": [
    ...
  ],
  "tags": {
    "name": "test"
  }
}

但我需要这样格式化的数据:

{
  "type": "node",
  "id": 123,
  "lat": 1.23,
  "lon": 4.56,
  "tags": {
    "name": "test"
  }
}

知道如何用立交桥转换数据吗?

背景:

我喜欢将立交桥数据转换为 gpi,但 gpsbabel 无法将 osm 方式转换为 gpi 的航点。

我只是收到这样的错误:osm: Way reference id "123" wasn't listed under nodes!

【问题讨论】:

    标签: openstreetmap overpass-api


    【解决方案1】:

    我想这里的问题是 gpsbabel 在您的回复中不理解center。相反,它会尝试读取所有节点及其坐标。但是您的回复不包括任何节点,只是对它们的引用。

    您也可以修改查询以返回所有必要的节点,而不仅仅是路径的中心:

    [out:json];
    way
      [amenity=drinking_water]
      ({{bbox}});
    (._;>;);
    out;
    

    然后 gpsbabel 应该可以解析此响应,但我不确定它是否是您正在寻找的响应。

    【讨论】:

    • 很好用,但现在 gpi 图标弄乱了我的地图,每个节点都被命名为 osm-1234
    • 很遗憾,我不熟悉 gpi,也不知道为什么会这样。
    • 我认为发生这种情况是因为 gpsbabel 只是将每个节点转换为航路点并忽略路径。这就是为什么我需要在中心有一个节点而不是整个路径。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-23
    • 2017-07-11
    • 1970-01-01
    • 2016-07-09
    • 2016-08-16
    相关资源
    最近更新 更多