1

What I have: a .gpx file which contains a series of waypoints, built via methods outlined here: Simulating Locations with Xcode.

What I want to do: A) Have Xcode simulate movement along a path outlined by the waypoints. B) change the rate at which those waypoints are ingested by Xcode (ie. simulate travel velocity).

Step A is working wonderfully, but I have not found any information on how to achieve step B.

Sample from .gpx file:


    <?xml version="1.0" encoding="UTF-8"?>
    <gpx
      version="1.0"
      creator="GPSBabel - http://www.gpsbabel.org"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://www.topografix.com/GPX/1/0"
      xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
    <time>2014-02-01T14:06:32Z</time>
    <bounds minlat="38.879180000" minlon="-77.978110000" maxlat="38.889860000" maxlon="-77.023940000"/>
    <wpt lat="38.889860000" lon="-77.023940000">
      <ele>0.000000</ele>
      <name>X</name>
      <cmt>X</cmt>
      <desc>X</desc>
    </wpt>
    <wpt lat="38.889740000" lon="-77.023930000">
      <ele>0.000000</ele>
    </wpt>
    <wpt lat="38.889620000" lon="-77.023900000">
      <ele>0.000000</ele>
    </wpt>
    <wpt lat="38.889520000" lon="-77.023870000">
      <ele>0.000000</ele>
    </wpt>
    <wpt lat="38.889430000" lon="-77.023840000">
      <ele>0.000000</ele>
    </wpt>
    <wpt lat="38.889426700" lon="-77.023838900">
      <ele>0.000000</ele>
      <name>National Mall, Washington, DC</name>
      <cmt>9th Street Expressway, Washington, DC 20565, USA</cmt>
      <desc>9th Street Expressway, Washington, DC 20565, USA</desc>
    </wpt>
    <trk>
      <name>Directions from X to National Mall, Washington, DC</name>
    <trkseg>

    </trkseg>
    </trk>
    </gpx>

jfrattarola
  • 171
  • 6
  • 1
    possible duplicate of [When using GPX in Xcode to simulate location changes, is there a way to control the speed?](http://stackoverflow.com/questions/9439495/when-using-gpx-in-xcode-to-simulate-location-changes-is-there-a-way-to-control) – jrturton Feb 04 '14 at 15:14
  • you may want to add some code on how you are simulating right now. – Volker Feb 04 '14 at 15:14
  • I'm not aware of any way to do this; you could instead group or space out the waypoints in your file to simulate different speeds? – jrturton Feb 04 '14 at 15:14
  • @jrturton - thanks. I didn't see that when I searched StackOverflow – jfrattarola Feb 04 '14 at 17:50
  • No problem. I wanted to do the same myself recently so it was pretty fresh for me... – jrturton Feb 04 '14 at 18:58

2 Answers2

4

I'm running Xcode 7.1 and when using custom GPX files, I have noticed that the simulator does play them back including timing (if present) in the GPX file. You can also vary the time between points to "simulate travel velocity". However, what Apple appears to be doing under the hood is interpolating your data and providing GPS updates every second. Since it is interpolating the GPX wpt, it does not use the speed, course, or accuracy from the GPX wpt tags. I always see accuracy of 5 meters, -1 speed, -1 course and the time is used for how to interpolate between waypoints. The actual time reported is of course the current time for each reading. Once the last waypoint is reach is goes immediately back to the first waypoint.

Here's an example file with variable time between waypoints. You can play it using the simulator and watch the Apple Maps app to see it play out.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="bikehike.co.uk" version="1.1" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<wpt lat="33.102265" lon="-96.788330">
  <ele>13</ele>
  <time>2013-12-02T12:00:10Z</time>
  <name>pt0</name>
</wpt>
<wpt lat="33.103990" lon="-96.787085">
  <ele>13</ele>
  <time>2013-12-02T12:01:20Z</time>
  <name>pt1</name>
</wpt>
<wpt lat="33.105428" lon="-96.784124">
  <ele>13</ele>
  <time>2013-12-02T12:02:30Z</time>
  <name>pt2</name>
</wpt>
<wpt lat="33.106860" lon="-96.780312">
  <ele>13</ele>
  <time>2013-12-02T12:02:40Z</time>
  <name>pt3</name>
</wpt>
<wpt lat="33.108401" lon="-96.776281">
  <ele>13</ele>
  <time>2013-12-02T12:02:50Z</time>
  <name>pt4</name>
</wpt>

Dave Morehouse
  • 241
  • 1
  • 7
  • I was going to implement this. Does the speed always remains 0? Event if it is mentioned in the GPX file? – nr5 Jun 02 '17 at 07:39
0

Currently no support for this in xcode.

DavidMFrey
  • 1,658
  • 1
  • 14
  • 14