如何从立交桥数据中获取名称标签和高速公路标签的价值?

时间:2017-03-27 18:20:46

标签: openstreetmap overpass-api

我想从立交桥turbo获取道路和位置名称的类型。这是一个代码段

 way[highway](9.7471,76.7153,9.7474,76.7162)[highway];
 (._;>;);
 out;

当我使用上面的代码进行查询时,它将数据作为

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2017-03-27T18:00:02Z"/>
  <node id="1026148112" lat="9.7462997" lon="76.7135716"/>
  <node id="1026148114" lat="9.7466238" lon="76.7140184"/>
  <node id="1026148117" lat="9.7471504" lon="76.7150035"/>
  <node id="1026148120" lat="9.7473103" lon="76.7154899"/>
  <node id="1026148123" lat="9.7473949" lon="76.7162087"/>
  <node id="1116474089" lat="9.7468330" lon="76.7143003"/>
  <node id="1651751027" lat="9.7487008" lon="76.7231996"/>
  <node id="1651751029" lat="9.7473639" lon="76.7167318"/>
  <node id="1651751035" lat="9.7487643" lon="76.7223199"/>
  <node id="1651751046" lat="9.7479929" lon="76.7182032"/>
  <node id="1651751050" lat="9.7487225" lon="76.7229936"/>
  <node id="1651751090" lat="9.7486583" lon="76.7233311"/>
  <node id="1651751094" lat="9.7485956" lon="76.7196302"/>
  <node id="1651751098" lat="9.7478975" lon="76.7176582"/>
  <node id="1651751106" lat="9.7489440" lon="76.7238648"/>
  <node id="1651751171" lat="9.7472843" lon="76.7169226"/>
  <node id="1651751174" lat="9.7486961" lon="76.7199896"/>
  <node id="1651751177" lat="9.7486802" lon="76.7215721"/>
  <node id="1651751202" lat="9.7483889" lon="76.7189725"/>
  <node id="1651751208" lat="9.7482361" lon="76.7185948"/>
  <node id="1651751214" lat="9.7473943" lon="76.7166102"/>
  <node id="1651751218" lat="9.7487119" lon="76.7206655"/>
  <node id="1651751220" lat="9.7484629" lon="76.7193533"/>
  <node id="1651751224" lat="9.7472906" lon="76.7169967"/>
  <node id="1651751242" lat="9.7479506" lon="76.7178277"/>
  <node id="1651751252" lat="9.7479506" lon="76.7180262"/>
  <node id="1651751254" lat="9.7486931" lon="76.7234620"/>
  <way id="270573607">
    <nd ref="1026148112"/>
    <nd ref="1026148114"/>
    <nd ref="1116474089"/>
    <nd ref="1026148117"/>
    <nd ref="1026148120"/>
    <nd ref="1026148123"/>
    <nd ref="1651751214"/>
    <nd ref="1651751029"/>
    <nd ref="1651751171"/>
    <nd ref="1651751224"/>
    <nd ref="1651751098"/>
    <nd ref="1651751242"/>
    <nd ref="1651751252"/>
    <nd ref="1651751046"/>
    <nd ref="1651751208"/>
    <nd ref="1651751202"/>
    <nd ref="1651751220"/>
    <nd ref="1651751094"/>
    <nd ref="1651751174"/>
    <nd ref="1651751218"/>
    <nd ref="1651751177"/>
    <nd ref="1651751035"/>
    <nd ref="1651751050"/>
    <nd ref="1651751027"/>
    <nd ref="1651751090"/>
    <nd ref="1651751254"/>
    <nd ref="1651751106"/>
    <tag k="comment" v="Motor Vehicle Speed as per Kerala Govt restriction"/>
    <tag k="highway" v="secondary"/>
    <tag k="is_in" v="kerala;india"/>
    <tag k="maxspeed" v="70"/>
    <tag k="maxspeed:bus" v="40"/>
    <tag k="maxspeed:motorcar" v="70"/>
    <tag k="maxspeed:motorcycle" v="50"/>
    <tag k="maxspeed:taxi" v="60"/>
    <tag k="name" v="Pravithanam Road"/>
  </way>
</osm>

从上面的数据我想得到key-&name; name&#39;的价值。 (即Pravithanam Road)和&#39; highway&#39; (即二级)。如何编辑上面的代码呢?

1 个答案:

答案 0 :(得分:3)

假设您只需要名称和高速公路,而结果中没有其他内容(不参考节点),您应该转为CSV输出格式:

[out:csv(name, highway)];
way[highway](9.7471,76.7153,9.7474,76.7162);
out;

否则,请更新您的问题并提供更多背景信息!