Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road geometry extraction #83

Open
qazi2 opened this issue Oct 18, 2019 · 0 comments
Open

Road geometry extraction #83

qazi2 opened this issue Oct 18, 2019 · 0 comments

Comments

@qazi2
Copy link

qazi2 commented Oct 18, 2019

Hi guys,

I am working on simulations and got stuck on while extracting data from OSM using overpy.Overpass API, I had a GPS data in the form of GPX format which includes the track, lat, long, alt, speed, time.

  • I am able to download the data from overpass API but the data is too large, I need the exact road node on which the car travel.

  • I also plotted the track on OSM and all the nodes are on road but I need the road nodes.

Please have a look towards the code, GPX file and help me in this situation.

CODE:

api = overpy.Overpass()

 #(minimum lat, minimum long, maximum lat, maximum long)
 result = api.query("""
 way(40.725968457, -73.973420095, 40.730816424, -73.971729884)[highway~"."][highway!~"path|track|cycleway|footway"];
(._;>;);
out geom;
  """)

Gpx data:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<gpx version="1.0" creator="GPS Visualizer https://www.gpsvisualizer.com/" xmlns="http://www.topografix.com/GPX/1/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
  <name>vid_21_final</name>
  <trkseg>
    <trkpt lat="40.730816424" lon="-73.973420095">
      <time>2017-10-03T11:13:17Z</time>
      <speed>19.71</speed>
    </trkpt>
    <trkpt lat="40.730676991" lon="-73.973266622">
      <time>2017-10-03T11:13:18Z</time>
      <speed>20.27</speed>
    </trkpt>
    <trkpt lat="40.730536343" lon="-73.973101918">
      <time>2017-10-03T11:13:19Z</time>
      <speed>20.84</speed>
    </trkpt>
    <trkpt lat="40.730397748" lon="-73.972929334">
      <time>2017-10-03T11:13:20Z</time>
      <speed>21.07</speed>
    </trkpt>
    <trkpt lat="40.730262757" lon="-73.972753482">
      <time>2017-10-03T11:13:21Z</time>
      <speed>21.14</speed>
    </trkpt>
    <trkpt lat="40.730120475" lon="-73.97258048">
      <time>2017-10-03T11:13:22Z</time>
      <speed>21.09</speed>
    </trkpt>
    <trkpt lat="40.729975845" lon="-73.972413261">
      <time>2017-10-03T11:13:23Z</time>
      <speed>21.06</speed>
    </trkpt>
    <trkpt lat="40.729814787" lon="-73.972260458">
      <time>2017-10-03T11:13:24Z</time>
      <speed>21.20</speed>
    </trkpt>
    <trkpt lat="40.729651004" lon="-73.972128276">
      <time>2017-10-03T11:13:25Z</time>
      <speed>21.13</speed>
    </trkpt>
    <trkpt lat="40.729483492" lon="-73.972018305">
      <time>2017-10-03T11:13:26Z</time>
      <speed>20.91</speed>
    </trkpt>
    <trkpt lat="40.729301688" lon="-73.971919986">
      <time>2017-10-03T11:13:27Z</time>
      <speed>20.89</speed>
    </trkpt>
    <trkpt lat="40.729118669" lon="-73.971847482">
      <time>2017-10-03T11:13:28Z</time>
      <speed>20.90</speed>
    </trkpt>
    <trkpt lat="40.728934435" lon="-73.971789898">
      <time>2017-10-03T11:13:29Z</time>
      <speed>20.99</speed>
    </trkpt>
    <trkpt lat="40.728745549" lon="-73.971752347">
      <time>2017-10-03T11:13:30Z</time>
      <speed>20.94</speed>
    </trkpt>
    <trkpt lat="40.728561441" lon="-73.971729884">
      <time>2017-10-03T11:13:31Z</time>
      <speed>20.52</speed>
    </trkpt>
    <trkpt lat="40.72838387" lon="-73.971730722">
      <time>2017-10-03T11:13:32Z</time>
      <speed>19.55</speed>
    </trkpt>
    <trkpt lat="40.728206341" lon="-73.971751006">
      <time>2017-10-03T11:13:33Z</time>
      <speed>19.95</speed>
    </trkpt>
    <trkpt lat="40.728025376" lon="-73.97177632">
      <time>2017-10-03T11:13:34Z</time>
      <speed>20.15</speed>
    </trkpt>
    <trkpt lat="40.727841016" lon="-73.971800124">
      <time>2017-10-03T11:13:35Z</time>
      <speed>20.52</speed>
    </trkpt>
    <trkpt lat="40.727653638" lon="-73.971818481">
      <time>2017-10-03T11:13:36Z</time>
      <speed>19.94</speed>
    </trkpt>
    <trkpt lat="40.727491616" lon="-73.971830048">
      <time>2017-10-03T11:13:37Z</time>
      <speed>17.90</speed>
    </trkpt>
    <trkpt lat="40.727331396" lon="-73.971863911">
      <time>2017-10-03T11:13:38Z</time>
      <speed>17.08</speed>
    </trkpt>
    <trkpt lat="40.727223815" lon="-73.97189551">
      <time>2017-10-03T11:13:39Z</time>
      <speed>12.15</speed>
    </trkpt>
    <trkpt lat="40.727135134" lon="-73.971920069">
      <time>2017-10-03T11:13:40Z</time>
      <speed>9.68</speed>
    </trkpt>
    <trkpt lat="40.727062379" lon="-73.971932223">
      <time>2017-10-03T11:13:41Z</time>
      <speed>7.87</speed>
    </trkpt>
    <trkpt lat="40.727004963" lon="-73.971937168">
      <time>2017-10-03T11:13:42Z</time>
      <speed>6.94</speed>
    </trkpt>
    <trkpt lat="40.726956851" lon="-73.971947813">
      <time>2017-10-03T11:13:43Z</time>
      <speed>5.83</speed>
    </trkpt>
    <trkpt lat="40.726913097" lon="-73.971958291">
      <time>2017-10-03T11:13:44Z</time>
      <speed>5.89</speed>
    </trkpt>
    <trkpt lat="40.726867919" lon="-73.971968601">
      <time>2017-10-03T11:13:45Z</time>
      <speed>5.84</speed>
    </trkpt>
    <trkpt lat="40.72681637" lon="-73.971978324">
      <time>2017-10-03T11:13:46Z</time>
      <speed>6.32</speed>
    </trkpt>
    <trkpt lat="40.72675711" lon="-73.971979665">
      <time>2017-10-03T11:13:47Z</time>
      <speed>6.98</speed>
    </trkpt>
    <trkpt lat="40.72669303" lon="-73.971989639">
      <time>2017-10-03T11:13:48Z</time>
      <speed>7.24</speed>
    </trkpt>
    <trkpt lat="40.726620066" lon="-73.972006822">
      <time>2017-10-03T11:13:49Z</time>
      <speed>8.17</speed>
    </trkpt>
    <trkpt lat="40.726544755" lon="-73.972028615">
      <time>2017-10-03T11:13:50Z</time>
      <speed>9.49</speed>
    </trkpt>
    <trkpt lat="40.726457331" lon="-73.972061304">
      <time>2017-10-03T11:13:51Z</time>
      <speed>10.21</speed>
    </trkpt>
    <trkpt lat="40.726367142" lon="-73.972098017">
      <time>2017-10-03T11:13:52Z</time>
      <speed>11.09</speed>
    </trkpt>
    <trkpt lat="40.726266224" lon="-73.972132132">
      <time>2017-10-03T11:13:53Z</time>
      <speed>11.50</speed>
    </trkpt>
    <trkpt lat="40.726170712" lon="-73.972169766">
      <time>2017-10-03T11:13:54Z</time>
      <speed>12.13</speed>
    </trkpt>
    <trkpt lat="40.726063591" lon="-73.972223243">
      <time>2017-10-03T11:13:55Z</time>
      <speed>12.71</speed>
    </trkpt>
    <trkpt lat="40.725968457" lon="-73.972284934">
      <time>2017-10-03T11:13:56Z</time>
      <speed>12.75</speed>
    </trkpt>
  </trkseg>
</trk>
</gpx>

Just need the road geometry of the road highlighted with pink line.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant