如何使用Overpass Turbo显示吉伦特省内无公证人的市镇轮廓
吉伦特省无公证人市镇轮廓查询方案
现有Overpass Turbo查询可获取吉伦特省轮廓及存在公证人的市镇轮廓,以下是修改后的查询代码,用于识别并绘制省内无公证人的市镇轮廓:
[out:xml][timeout:25]; // 定位吉伦特省对应的区域 area["ref:INSEE"="33"]->.a; // 搜索省内的公证人(包含节点和路径两种标记形式) ( node(area.a)["lawyer"="notary"]; node(area.a)["office"="notary"]; way(area.a)["lawyer"="notary"]; way(area.a)["office"="notary"]; )->.notaires; // 分离节点和路径分别处理 node.notaires->.notaire_nodes; way.notaires->.notaire_ways; // 确定公证人节点所在的市镇行政区域(admin_level=8对应法国市镇层级) .notaire_nodes is_in -> .potential_areas_nodes; area.potential_areas_nodes[admin_level=8]->.commune_areas_nodes; // 确定公证人路径所在的市镇行政区域 way.notaire_ways->.ways_notaires; (way.ways_notaires; >;); // 获取路径关联的所有节点 is_in -> .potential_areas_ways; area.potential_areas_ways[admin_level=8]->.commune_areas_ways; // 合并所有存在公证人的市镇区域 (.commune_areas_nodes; .commune_areas_ways;)->.all_communes_with_notaires; // 获取吉伦特省内所有市镇的边界关系 rel(area.a)["boundary"="administrative"]["admin_level"="8"]->.all_communes; // 核心逻辑:从所有市镇中排除有公证人的市镇,得到目标集合 rel.all_communes.diff(.all_communes_with_notaires)->.communes_without_notaires_rel; // 获取吉伦特省的边界 rel(area.a)["boundary"="administrative"]["admin_level"="6"]->.departement; // 输出省边界和无公证人的市镇边界 ( rel.departement; rel.communes_without_notaires_rel; ); out geom;
关键修改说明
- 使用Overpass的
diff操作符实现集合差运算:从吉伦特省所有市镇集合中减去存在公证人的市镇集合,直接得到无公证人的市镇集合 - 调整输出内容,仅保留省边界和目标市镇边界,去除原查询中的公证人节点/路径,聚焦需求结果
- 修正原查询中一处拼写错误(
rel.all_commues改为rel.all_communes)
内容的提问来源于stack exchange,提问作者Bruno GARRONET
相关产品推荐
相关产品推荐

