TransWikia.com

OpenStreetMap pbf files- extracts all street/roads intersections in a bounding box

Geographic Information Systems Asked on January 19, 2021

I wrote a query which extracts all street/roads intersections in a bounding box from OpenStreetMaps, as can be seen here:

    <osm-script>
<query type="way" into="hw">
  <has-kv k="highway"/>
  <has-kv k="highway" modv="not" regv="footway|cycleway|path|service|track"/>
   <bbox-query e="51.0" n="50.748" s="50.746" w="7.154"/> 
</query>
 
<foreach from="hw" into="w">
  <recurse from="w" type="way-node" into="ns"/>
  <recurse from="ns" type="node-way" into="w2"/>
  <query type="way" into="w2">
    <item set="w2"/>
    <has-kv k="highway"/>
    <has-kv k="highway" modv="not" regv="footway|cycleway|path|service|track"/>
  </query>
  <difference into="wd">
    <item set="w2"/>
    <item set="w"/>
  </difference>
  <recurse from="wd" type="way-node" into="n2"/>
  <recurse from="w"  type="way-node" into="n3"/>
  <query type="node">
    <item set="n2"/>
    <item set="n3"/>
  </query>
  <print/>
</foreach>
  </osm-script>

However, I want to work locally on PBF files so I need to figure out how to do it. is it possible to extract all street/roads intersections in a bounding box using OSMFILTER/OSMCONVERT/Osmosis/OTHER?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP