【问题标题】:Separate forward and backward relation in overpass-api在overpass-api中分离前向和后向关系
【发布时间】:2015-06-15 00:55:29
【问题描述】:

我需要从 overpass-api 获取有关一条特定公共交通线路的所有数据。假设我所在的城市有 148 号。

I use something like this example below 但这给了我前进和后退路线的组合方式。我怎样才能分别获得它们?

<osm-script output="json">
  <union>
    <query type="relation">
      <has-kv k="ref" v="148"/>
      <bbox-query s="54.21466404047702" w="18.270263671875" n="54.503143645746924" e="18.840179443359375"/>
    </query>
  
    <recurse type="down" />
  </union>

  <print mode="skeleton" order="quadtile"/>
</osm-script>

【问题讨论】:

    标签: gis openstreetmap overpass-api


    【解决方案1】:

    您可以按角色过滤: http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_.28n.2C_w.2C_r.2C_bn.2C_bw.2C_br.29

    这里是其他路线的示例,有前进和后退的方式。

    [out:json][timeout:25];
    
    (
      //get relation
      relation["route"="bus"][ref=157]({{bbox}});
    
      // get ways with particular role
      way(r:"forward");
    
      // you may also add ways with empty role if you want
      // give role as an empty string
      //way(r:"");
    
      // get way nodes.
      // We can't use >; operator, because it will recurse to
      // all relation members.
      node(w);
    );
    
    out skel qt; 
    

    在 overpass-turbo 上试一试: http://overpass-turbo.eu/s/a4F

    【讨论】:

      猜你喜欢
      • 2021-04-25
      • 2019-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-19
      • 2011-02-09
      相关资源
      最近更新 更多