Using GPX file in iOS simulator doesn't stop at the last coordinate, keeps looping
Asked Answered
T

3

9

I've been reading through a lot of questions/answers relating to the simulation of location on the iOS simulators, but none touching on my specific issue. I have a prototype of a location aware application which I configured to use a GPX file as described in this answer: How to solve Xcode 4.1 (LION) GPS error?

It works great and it provides all the information I need, with one exception. I was expecting the location updates to stop as soon as we moved into the last position defined in the GPX file. Instead, the current location keeps updating in a loop. It returns to the starting position, and loops until you stop it.

I've tried marking positions around the area where I want it to linger at, but it ignores them. It could have something to do with the minimum change in position, but it just ignores it and continues with the loop.

Created a quick project to illustrate the issue and loaded it to GitHub: https://github.com/acolchado/LocationPrototype

To reproduce follow these steps:

  1. Load the project in xcode, I created it using xcode 4.4.1.

  2. Run the project.

  3. From the debug panel, locate the location arrow. Click on the arrow and select "SanBruno_To_Downtown_SF" from the context menu.

  4. Bring the simulator to the foreground and observe the endless loop.

I have looked everywhere for a solution for this, but I am unable to find any mention of the loop. I would greatly appreciate any help anyone could offer here.

Thanks,

Agustin

Thissa answered 5/9, 2012 at 18:50 Comment(1)
any luck on getting something better than the cheat?Transmissible
T
4

my cheat:

just copy paste the last waypoint in your .gpx file a bunch of times (enough to keep it stuck there until it satisfies your criteria)

Transmissible answered 16/11, 2012 at 17:22 Comment(0)
M
3

You can also add a timestamp in the gpx file. Make yourself linger at the last stop by having a really long timestamp.

Mosley answered 18/7, 2016 at 17:13 Comment(1)
Add some explanation with answer for how this answer help OP in fixing current issueHeyward
S
1

What worked for me was a combination of the other two answers plus modifying the last/duplicated coordinate slightly.

  1. Duplicate the last coordinate.
  2. Modify the last/duplicated coordinate so it's not a duplicate anymore. Apple must be ignoring exact duplicates.
  3. Give the last coordinate a long time stamp.

Example:

<wpt lat="37.782511" lon="-122.448453"><time>1970-01-01T00:00:00Z</time></wpt>
<wpt lat="37.782051" lon="-122.451981"><time>1970-01-01T00:00:05Z</time></wpt>
<wpt lat="37.782050" lon="-122.451981"><time>1970-01-01T10:00:00Z</time></wpt>
Selfpity answered 19/9, 2022 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.