David Shanske
- Weight: 8 pounds, 3 ounces
- Length: 20.5 inches
- Head: 13.5 inches
- Chest: 13.5 inches
The Definitive Location
David Shanske
Version 4.0.0 adds/rewrites a lot of the plugin.
A few notes
json = json_decode( $file, true ); $json = $json['locations']; foreach( $json as $item ) { $date = date_create_from_format( 'U', round( $item['timestampMs'] / 1000 ) ); if ( $item['latitudeE7'] > 900000000 ) { $item['latitudeE7'] = $item['latitudeE7'] - 4294967296; } if ( $item['longitudeE7'] > 900000000 ) { $item['longitudeE7'] = $item['longitudeE7'] - 4294967296; } $output = array( 'locations' => array( array( 'type' => 'Feature', 'geometry' => array( 'type' => 'Point', 'coordinates' => array( ( $item['longitudeE7'] / 1e7 ), ( $item['latitudeE7'] / 1e7 ) ) ), 'properties' => array( 'timestamp' => $date->format( DATE_W3C ), 'horizontal_accuracy' => $item['accuracy'] ) ) ) ); if ( array_key_exists( 'activity', $item ) ) { $output['locations'][0]['properties']['activity'] = $item['activity']; }
For activity, it only appears on some entries, and is for the most part, accurate enough..
"activity" : [ { "type" : "IN_VEHICLE", "confidence" : 100 }
It notes the type of activity, and the confidence level. However, in this example…
"activity":[ {"type":"UNKNOWN","confidence":50}, {"type":"ON_FOOT","confidence":36}, {"type":"ON_BICYCLE","confidence":11}, {"type":"IN_VEHICLE","confidence":2} ]
In this example, Google thinks I am either doing something unknown, walking, riding, or on a bicycle. I promise, never a bicycle. So, for now, I consider the information to be less than useful, but am storing it for future use only.
Looking forward to using the data in interesting ways.
Indianapolis’s The Recession has Driven this Bookseller to Drink Bookstore newest bookstore combines two old friends: alcohol and books.
Books & Brews, which just opened last week, is the work of Jason Wuerfel. Jason has always wanted to open a bookstore, but with a tight economy and businesses fail…
Have you ever been on a blind date? New York Gilbert & Sullivan Players presents The Mikado December 27, 2019-January 5, 2020 at the Kaye Playhouse at Hunter…
IndieWebCamp Berlin2 is an all-levels BarCamp-like collaboration in Berlin for two days of keynotes, brainstorming, creating, teaching, and helping gain more control over our data and lives online!
Start:
End:
I joined the Indieweb community in 2014, and I feel after 5 years of work, things started to come together. We have a robust collection of plugins and opportunities. But over the coming months, there are some long term goals that need to be achieved.
There are obviously other things I’d like to do…improve Micropub for one. but the above are the ones that I think would push things forward the most.
The problem is transforming the input from Southwest into the format another system can accept. I did not want to write an Android app for this…I wish there was one.
So, instead I used Tasker, an automation app for Android that does have scripting in it.
So, if you retrieve http://getconnected.southwestwifi.com/current.json, you get the following JSON data.
{ "pcent_flt_complete": 0, "altVal": "-24", "lon": "-73.867", "satcomm_status": { "commlink": "active", "linkparams": "not-stale" }, "dtzone": "CDT", "within_us": true, "etad": "09:20 AM", "lat": "40.775", "gspdVal": "10", "ttgc": "2h 15m", "dist_remain": "888", "actime24": "07:05" }
The Task I created consists of three actions. It uses the HTTP Request action to get the above JSON. Then it uses the below JavaScriptlet(Tasker allows you to write JavaScript, to convert the data into the GeoJSON that Compass expects. The third action posts that to Compass.
var parsed = JSON.parse( http_data ); var gmt = new Date().toISOString(); var alt = Math.round( parsed.altVal * 0.305 ); var feature = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [parsed.lon, parsed.lat, alt] }, "properties": { "timestamp": gmt, "percent_complete": parsed.pcent_flt_complete, "dist_remain": parsed.dist_remain, "source": "flight", "airline": "wn" } }; var compass = { "locations": [feature] }; var featurejson = JSON.stringify( compass );
Now, I am known for not doing much JavaScript work, preferring PHP. But this was simple enough. I could have added more of their parameters, or, since Southwest does not put the flight number into their JSON, allow it to be set.
It is triggered when I am connected to SouthwestWifi, in Airplane Mode, and every 5 minutes. I wasn’t sure if I should poll more often, but 5 minute intervals seemed reasonable. Regrettably, Southwest does not provide more parameters like speed.
I wish some developer would write an app that would do this, partially because, if the wifi goes down, the request will fail and I’ll lose it. I’d rather cache and retry. Also, GPS Logger has some limitations. I wish there was an Android version of Aaron Parecki’s Overland app. Being as he wrote Compass, it works well with that and has those caching features.
I have two flights on two different airlines in the next month, and will see if I can write similar scripts. I enjoy the challenge of trying to write and test it on my phone live.
Next, I need something to display a visualization of this with altitude.