Some Bits: Nelson's log

4 posts about wanderings

Wanderings tracker vs GPSLogger

Summary: after 9 months, the GPS data being logged by GPSLogger on Android looks good to me. At least good enough for Wanderings’ location tracking and heatmap.

One casualty of my switch from iPhone to Android is my own Wanderings app, a lightweight GPS tracker that Brad and I worked on together. There’s an iPhone app that tracks your movements and records data and a webapp that displays the data. But we don’t have an Android version of our tracker and I’ve been unmotivated to learn enough Android to write one.

I have been running Mendahk’s excellent GPSLogger though and it is faithfully recording my location every day to GeoJSON and CSV files in Google Drive. I finally got around to collecting all that data and visualizing it with our web app. Qualitatively it looks the same as the data collected a year ago by the Wanderings tracker. That’s good! See screenshots below.

I haven’t done a deep quantitative comparison. But GPSLogger recorded 218,451 points over 284 days, of which 90,877 points were more than one minute apart from each other (a cutoff we use). By comparison our own tracker only stored 6248 locations for me over 574 days. That’s 319 points a day compared to 11! GPSLogger calmed down a whole lot though starting in September, down to about 70 points a day. I suspect that’s when I disabled passive location tracking, resulting in many fewer points logged.

Still GPSLogger is recording 7x as many points as Wanderings. The extra points are harmless to the visualization output but they do incur some storage and processing overhead. The Wanderings tracker is using the iOS Significant Location Change service and only seems to record points when you’re really moving. GPSLogger is configurable in recording granularity. I have it being somewhat aggressive: GPS/GNSS locations, network locations, and a 60 second logging interval with a 10 meter distance filter to log a new point.

I went ahead and looked at distances between points in the GPSLogger output using geopy’s calculation. A whole lot of pairs of points are less than 20 meters apart. I don’t really know what’s correct here, since you do want to capture data with fidelity when the subject is moving. Probably overthinking it. Here’s a quick and dirty histogram of distances for all pairs less than 100 meters apart.

And here’s the promised gallery of app screenshots. Two similar time periods, one year apart. The older is the iPhone tracker and the newer is GPSLogger on Android. They really do look similar.

New release of Wanderings, in which I learn to love Webpack

Brad and I pushed our first new release of Wanderings since the big release last January. No user visible changes, but we upgraded all the versions of third party packages and build tools we were using.

The real thing is I had to get over being whiny about webpack and npm. Right after we finished 1.0 Brad stepped in and reorganized our code to use fancy web tools. Previously we just had a big ol’ wanderings.js file we imported on every page, along with a bunch of third party minimized redistributables included one after the other in the HTML file. You know, the old school way. Brad redid everything nicely in webpack and npm so that third party modules were fetched from a repository and bundled together. Our code was refactored and then combined into the bundle. All with nice frontend scripts like “test” and “deploy” and “start development server”.

Unfortunately I don’t know anything about these fancy new fangled tools, I live or die by press-F5-in-the-browser. And it was kind of a big hump for me to get over it, learn the tools, and use them. I have a categorical problem any time someone tries to inject a “compile” or “link” phase into what should be simple interpreted code. It always slows me down. npm is very hard to love, too.

But webpack solves a lot of problems too. Managing distributing the right versions of things. Bundling them so they distribute efficiently. Minimizing the code for obfuscation + network savings. Keeping it possible to still run devel versions with source maps, etc for easy debugging.

The fancy devel server we get from webpack is pretty nice too. It seems to automagically arrange for things to recompile and reload when they change. I had a problem with this at first because our devel bundle is like 4.5 megabytes and I was running my devel server remotely, on another continent. That’s a bad idea; once I got the devel server running locally on my laptop it was much better. (We might want to split our bundle into two pieces though, a big one of third party code that seldom changes and a small one of our own code. Just to keep reload overhead down).

I’m still grumpy about some things. I’ve lost all my global variables I used to reach into to inspect the state of the running system in the console. I’m not sure I can get the Firefox debugger working at all, the source maps or something aren’t working. Chrome seems better though.

I still hate imposing any overhead in the “change code, reload, run” loop. But all this build stuff solves real problems in the Javascript ecosystem so I think it’s best to play along.

Deleting iCloud database records is very slow

Wanderings uses iCloud’s private databases as a backing store for data. I wanted to delete some data from them and it is terribly, terribly slow. Roughly 40ms / record.

We’re using this Javascript code to delete records:

CloudKit.getDefaultContainer().privateCloudDatabase.deleteRecords(data)

If the data is 100 records it takes 4000-5000ms to complete. 10 records takes about 400-500ms. So much for batch deletion.

Exacerbating this we had a bug where I was trying to delete 60,000 records at once. This hangs for a very long time and then returns with an error that the operation is too big. Also there was a second bug where we were executing several requests in parallel. This does seem to work but isn’t a good idea. Chrome crashes outright (Oh, Snap) if 26 requests are running in parallel. Firefox didn’t crash but other bad things happened.

So now I’m deleting 60,000 records, 100 at a time every 5 seconds. That’ll be most of an hour.

 

Launched Wanderin.gs!

My friend Brad and I launched Wanderings, a simple location tracker app for iPhone and Web. Put it on your phone and forget about it, come back a few weeks later to have a nice heatmap of where you’ve been. It was inspired by the late lamented OpenPaths. See also Google Timeline, which is much fancier but doesn’t have a heatmap.

I was inspired to start working on this while traveling in Berlin. I just want to know where I’ve been, you know? I don’t know anything about building iPhone apps but fortunately Brad does.

The best part of the app is that we went serverless; we don’t have our own database or server processing location points anywhere. The iPhone app uploads directly to iCloud. Javascript in the web page downloads it directly and renders it. That’s good for privacy and also simplicity. I seem to be building all my web apps this way these days; Logs of Lag, Wind History, etc all work without significant server components. Sure is easy to scale and maintain.

Some of the interesting stuff we use:

We have lots of ideas for future features. Some particular ideas I’m excited to do:

  • Import of data from other sources
  • Some sort of time-based visualization
  • Android app (not me!)

It’s a modest project but I’m proud of it.