【问题标题】:Finding geometry of an area with overpass API使用立交桥 API 查找区域的几何形状
【发布时间】:2015-05-18 14:47:03
【问题描述】:

我正在尝试从特定纬度经度找到建筑物的几何形状。所以我的想法是使用坐标查询来获取 lat,lng 所在的所有区域。使用http://overpass.osm.rambler.ru/cgi/interpreter,我可以获取所有区域,并且可以过滤以仅获取建筑物的节点。

现在我有一个区域,例如:

{ id: '2542062474',
    'addr:city': 'Nice',
    amenity: 'place_of_worship',
    building: 'yes',
    denomination: 'protestant',
    name: 'Église Protestante Unie de Nice Saint-Esprit',
    religion: 'christian',
    source: 'cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' }

我认为获得该区域的几何形状很容易,但我找不到任何方法?我一定是错过了什么。

http://overpass-turbo.eu,我输入脚本:

[out:json][timeout:25];
// gather results
(
  // query part for: “area”
  area(2542062474);
);
// print results
out body;
>;
out skel qt;

但结果不包括几何。如何获得区域的几何形状?

谢谢!

这是我的脚本,目前:https://gist.github.com/ptbrowne/60d7338502de1d16ac46

【问题讨论】:

    标签: overpass-api


    【解决方案1】:

    Areas 是 Overpass 的内部数据类型。您可以使用pivot 获取几何图形:

    [out:json][timeout:25];
    area(2542062474);
    way(pivot);
    out body;
    >;
    out skel qt;
    

    【讨论】:

      【解决方案2】:

      最后,我做的是阅读更多文档并发现要获得与 area 关联的 way,我需要减去 @987654321 @来自区域id

      那我只能查询路了。从区域 id 2542062474,我减去 2400000000,我得到 142062474

      [out:json][timeout:25];
      way(142062474);
      out body;
      >;
      out skel qt;
      

      它有效,但我认为@Alex Morega 的pivot 答案更好,因为2400000000 可能有一天会改变。我不知道性能。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-19
        • 1970-01-01
        • 2021-05-16
        • 2022-12-01
        • 1970-01-01
        • 2020-05-14
        相关资源
        最近更新 更多