25 April 2014

Strava: A Better Way to Train

Throughout history, human kind has sought to perfect skills with repeated practice. All of us have at one time or another completed a challenging task and wondered "did I do better this time?".  Athletes training on a team benefit from the real time feedback of their coach or team mates, meaning focus remains on good form and proper pacing without staring at a clock. For those of use who do not train with a coach or trainer, the question than becomes "how do I know how I am doing?"

In the good old days, a mechanical stop watch dangling around one's neck was state of the art in terms of self-evaluation, assuming that one took the time to stop and read the watch. Thankfully, today we have something so much better!

The old fashioned way to train....


Meet Strava, a social training platform that provides personalized,  real time feedback and metrics during runs and rides. The premise is simple - capture GPS data of a run or bike ride and analyze that data to answer the question "how did I do?". In fact, I have been trying to do this for years using my cumbersome GPS unit. I'd collect the data, import a GPX onto my computer, view and edit, generate speed and elevation profiles, and ultimately attempt to publish my data. Unfortunately, this process was entirely too time consuming to do regularly, meaning my data piled up in a messy virtual junk heap. Thankfully, Strava's smartphone app and web platform provide a powerful training analytics platform where difficult data capture and manipulation processes have been elegantly automated.

I signed up for a free Strava account, downloaded the application onto my android phone, and set off for a ride on my trusty Univega. I was quickly impressed by how intuitive the application was to use, and how little battery power it consumed (a big issue for GPS-dependent apps). When I finished my ride, I was delighted to see my phone displaying a map of my route along with some basic stats: avg MPH, elevation chance, and distance. My route was automatically uploaded to Strava's cloud service where I can view more detail. Additionally, the application breaks a route into segments based on segments created by other Strava users, allowing users to compete against each other on the same segment, with the fastest riders listed on that segment's leader board. Additionally, I can track my progress per segment, meaning that a huge hill doesn't  bring down my avg MPH for the whole ride.

My recently ride was automatically broken into segments by Strava.


As a casual athlete, I find this app incredible exciting. It's super easy to use, and provides analytics which are useful for both casual runners and riders as well as serious athletes. Additionally, it's fun to know how you rank against other users. Because I know others can see my performance, Strava gives me the distinct feeling that every run and every ride count. There is no time to be lazy and take it easy, because now we have a virtual crowd-sourced team to encourage us during that last mile when things seem the toughest. Thanks to Strava, my workout routine is new and exciting again, and I can't wait for my next ride.

My (as of yet very limited) activity overview. Cool!

03 February 2014

iBeacon: A Promising Solution For Indoor Location Opens New World of Smart Shopping

iBeacon is a new indoor location system developed by Apple for iOS devices. An iBeacon is a cheap, self-contained piece of hardware which utilizes Bluetooth Low Energy to interact and exchange information with nearby devices. Each iBeacon may inform the device of it's current location, and can also exchange info with the device. 

For example, An iBeacon might be able to recognize a shopper's loyalty card number, and serve special offers based on a consumer's buying habits. Additionally, each iBeacon knows it's own location, so a mobile device can locate itself based on which iBeacons are within range. 

Value of Indoor Location to Consumers
Indoor location allows consumers to find their way around stores more easily by enabling precise indoor location fixes. Retailers can provide immense value to consumers by integration location with inventory systems, making a store's inventory searchable in real time. Additionally, by providing APIs to this location and inventory data, it would be possible to cross reference a consumer's location and shopping needs with current store inventory.


Classic use case for indoor location.


My vision of this smart shopping experience would entail an application such as Simple Note or Google Docs being able to compare my shopping list and current location to the current inventory of nearby stores and alert me when I am near a store with items I need in stock. If I enter the store, I would be able to follow turn-by-turn directions to any items I that were on my list.

To go a step further with this scenario, imagine a service which finds the cheapest price for each item on one's list by searching inventories of nearby stores, and them sorting the items into a shopping list for each store. This would empower the consumer to know which stores to go to, and which items to purchase at each.
As someone who has tends to get lost in big box stores, I would greatly appreciate the ability to digitally plan my shopping.




Apple's iBeacon collateral.



How iBeacon Works

iBeacon uses the latest bluetooth standard (Bluetooth Low Energy) to passively communicate with compatible devices, but can only interact with device if the user has installed an iBeacon enabled app.For example, if I install a store's application and go into that store, the iBeacon signals may interact with the applcation to show me special offers. 

Privacy Protected

The app may send my personal info to the beacon, but only if I have given permission to do so. In short, iBeacons protect user privacy because they require device-based permissions to show messages or collect user info. The device cannot send or receive any info on the user's behalf without an application explicitly installed and approved for that purpose.


Every iOS device can act as an iBeacon
to exchange info with passing devices.,


Apple's Advantage

By the time Apple brought this new standard to market, they had been working on incorporating iBeacon functionality into their devices for some time. The end result is that the last several generations of iOS devices support iBeacon; not only can they interact with iBeacons, but each device can by itself serve as an iBeacon for other devices. iBeacons will be available as dedicated hardware, but since every Apple device can act as an iBeacon to other iOS devices, existing Apple devices can engage in this exiting new protocol, exchanging information as the two devices pass each other. No other hardware maker can claim this advantage.


Android Compatible

So far Apple has announced the iBeacons are compatible only with certain Bluetooth Low Energy enabled iOS devices, leaving Android users wondering if iBeacon works for them. We do not yet know for sure, but it stands to reason that any Bluetooth Low Energy enabled device should be able to interact with iBeacons. Based on Apple's previous behavior, it stands to reason that non-Apple devices would work with iBeacon, but exclusive features will be available to Apple users. 

Bottom Line

Indoor location is the next frontier in the mobile location space, and Apple has a significant head start. iOS 7 contains advanced location technology to pinpoint location indoors and exchange location-relevant information. iBeacon may have limited compatibility with other devices, but only iOS device users will realize the full benefit of iBeacon at present.


24 January 2014

Google Maps Indoor

Online Maps, such as those offered by Google, have become the cornerstone of wayfinding in today's always-connected world. I use Google Maps regularly to plan a route, find the right subway stop,  or even just check traffic. Until recently, navigation has focused on outdoor navigation only, meaning that a Google Maps user will have no trouble finding the desired building, but then must find their own way once inside. Google is working to change that with a new indoor mapping product.

Classic (confusing) map of a mall.
If I am in the green, how do I get to the red?
How do I cross the black abyss
between the red and purple stores?
Where is the exit?!?

Google Maps Indoor has recently starting mapping public indoor spaces and incorporating these maps into the Google Maps application on Android. A user can view inside an eligible building simply by zooming in on the map. The maps can be quite detailed, showing hallways, rooms, bathrooms, elevators and stairwells on each floor of a building.

Maps Inside view
of the GooglePlex


Indoor maps will be the next revolution in location technology. Map users will be able to navigate even the most confusing complexes with ease and find their exact destination within the building. As exciting as the prospect of indoor navigation is, there are some significant challenges remaining:

1) The maps must be made. Outdoor streets and spaces have been mapped and remapped over the years by a variety of organizations, resulting in a comprehensive, up-to-date mapset. Interior maps, on the other hand, exist for few buildings. Building owners must upload floorplans for their buildings in order to be included in google maps indoor. For a helpful video on how to do this, click here.

2) Lack of Indoor Location. Most mobile devices are not yet able to determine their location inside a building, meaning that the device can display an interior map of a given building, but cannot indicate where that device is on the map. NFC has provided limited solutions allowing a device to be tapped to an NFC terminal to indicate that "I am here" but this method is quite primitive and usually requires the user to actually touch their phone to a reader. Apple's iBeacon shows promise as a means to determine indoor location, but iBeacon roll-out has not yet reached critical mass of adoption.

3) No Indoor Routing Instructions. The ultimate goal with indoor mapping is enable turn-by-turn navigation inside buildings. The ability to view indoor map data is a start towards this end, but a device must also be able to determine it's indoor location to accurately navigate. In addition, each building must be associated with a routing table, which helps the map software understand how different pathways interconnect throughout the building. Without a routing table, the mapping application has no idea if Hallway A connects to Hallway B, or if the door in Hallway B opens one way or both, etc. 

Toggling between floor 1 (right) and floor 2 (left)
of the interior of the GooglePlex.

16 December 2013

Twitter Entices Users to Share Location Data

Twitter is reportedly experimenting with a new feature which will show nearby tweets on a map. This feature, currently referred to as "Nearby," appears designed to encourage users to geo-tag their tweets by providing the user value in sharing their location information.

Currently, users may geo-tag a tweet, but this feature is not enabled by default. Twitter is attempted to make money by selling advertising, and having more location info about more users will make Twitter's advertising inventory more value.



Users get the benefit of being able to see what is going on around them. This may be immensely useful for finding out about current news and further cements Twitter's position as the go-to source for news happening right now.

Imagine seeing a plume of smoke rising from ten blocks away - the first thing most of us tweeters would do is search Twitter for likely keywords, i.e. "smoke SF Financial district." Even the most artfully crafted searches still leave the user sorting through a huge amount of content. Twitter's new "nearby" feature will allow users to see tweets based on their geo-tagged location, making it much easier to see tweets being sent from the area of interest.



Note that geo-location enabled tweets have been possible for some time now. Several years ago, I worked with a developer who was making a "heat map" of tweets containing a given keyword. Higher tweet densities were represented with brighter colors on the map. I do not know the technical solution this developer had implemented, but so far as I can tell, Twitter's new API does not add new functionality, but rather, makes existing functionality available to users posting from 3rd party clients.

I am excitedly waiting to see the community's response to this new feature. New features often lead to new and previously un-imagined features, but the privacy challenges are daunting....


Good luck, Twitter!

12 December 2013

Winter Cruise around Angel Island

We received our first winter storm recently here in the San Francisco Bay. A cold low pressure system moved in from Alaska and brought with it freezing temps, driving winds, and several inches of rain. I found this inclement weather to be a welcomed break from the typical winter pattern cool, calm, hazy days. The worse of the rain moved past after a few days but left behind strong winds. I couldn't help but take advantage of this break from typical winter calm to go for a sail.

After grabbing some sandwiches and bundling up against the cold, I headed out of Loch Lomond Marina in San Rafael and set a source south to Angel Island. Taking advantage of the unusual wind out of the north west, we had a leisurely cruise under the Richmond San Rafael Bridge and down towards the bustle of one of the world's most iconic waterways. 


Our route on the San Francisco Bay.


Leaving Loch Lomand Marina  - Must make sure to
make the turn WIDE to stay in deep water!
Loch Lomond Marina is difficult for sailboats. The marina sits about one mile from the deep water channel on the edge of a tidal mud flat. The water depth leading up to the marina is about two feet, which is tricky because the sailboat I use requires five feet of depth to pass safety. Fortunately, there is a channel dredged across the mud flat which is deep enough to navigate in a sailboat. Unfortunately, this channel is poorly marked and very narrow, and the only sure way to know you're not in the channel is once your vessel becomes mired in mud.

As you can see in the above picture, there is a small channel out of the marina which feeds into a slightly larger channel at a ninety degree angle (the blue line is the path taken by my vessel through these channels). Both channels are marked poorly, and the areas immediately surrounding this turn are especially shallow. Too wide of a turn will run one aground, as will too narrow of a turn. I have "played in the mud" here on several occasions, and have learned to not even attempt entry at low tide. 





Unusual NW winds allowed us to sail
under the Richmond Bridge.
Successful transit of the San Rafael Bridge under sail power was possible because of the storm's unusual winds out of the north and west. The prevailing wind, out of the south and west, is readily blocked by the bridge, making it difficult to safely cross without starting the motor. The wind out of the north, however, was able to keep the sails full all the way under the bridge - a rare treat!

Clearing Raccoon Straights.


Squeezed between Angel Island and passing some container ships.

Rounding Angel Island brought us head to head with a line of oncoming container ships. Luckily I was able to hug the coast and stay out of their way (and their wakes).

The fun upwind portion of the sail.

After rounding the southern tip of Angel Island and taking in some great views of San Francisco, we headed back upwind. Sailing against the wind is much rougher and more difficult than sailing with the wind. A sailboat cannot move directly into the wind, so we had to tact back and forth across the wind many times to get back upwind to where we started.

Going upwind is a lot more work than going downwind.



Check out our recorded speed (the blue line).

We averaged 4.4 mph, which is not bad for the entry-level 27 foot sailboat we were sailing. During some of the heavier gusts, we hit close to 8 mph!

Complete route map - zoomable and scrollable!



View Larger Map


14 June 2013

Open (Source) for Business?: My First Attempt at Deploying an Open Source Spatial Database

All modern geographers face the critical decision of  selection an appropriate GIS. There are many options from which to choose, and each offers unique benefits while invariable containing some drawbacks. Open source solutions  such as GrassGIS, Viking GIS, and my current favorite, Quantum GIS have the main advantage of being free to use, and allowing for great data portability between applications. In terms of close sourced GIS solutions, ESRI's ArcGIS rules the pack. ArcGIS is very prominently used by governments and other large organizations who want a solution that will offer reliability and that comes with support and complete documentation.

Well structured data is essential success in any GIS project.
All good databases are thoughtfully designed  in advnaced.

I cut my spatial teeth at University of California, Santa Barbara, where ESRI is the GIS of choice. Reflecting on my early GIS years, I feel somewhat shortchanged that my instructors did not expose me and my colleagues to open source GIS solutions. Once I graduated, I lost my school-provided ESRI seat license, and I needed to find a cheaper alternative to ESRI's products. And by cheaper, I mean free, because when it comes to GIS software, the options are either extremely expensive (ESRI) or free (most other GIS applications). 

After experimenting with a few options, I settled on Lisboa's Quantum GIS. Quantum GIS (qgis for short) has a clean and logical UI and is a comfortable switch for an ArcGIS user such as myself. I quickly discovered how to utilize the functionality I was looking for, and soon was using qgis to contently import, clip, rasterize, merge, and project, and export data.

Before too long, I had some large CSV datasets to work with for a consulting project. I converted the data into a shapefile, and quickly learned that shapefiles are not an effective storage format for 1.5 million data points, which unfortunately is the size of the data set with which I am working.

I wish I had more RAM. (Not actually me in this picture).
As my Dell laptop (with a humble Core i-3 chip and 4 gigs of slow RAM) tried desperately to crank away at spatial queries on this enormous shapefile, I become intimately acquainted with all varieties of program and system crashes. After a few unsuccessful days of booting and rebooting, I decided I needed to put my data in a more scalable format. 

Enter: The Spatial Database. 

Had I been using ESRI, a Geodatabase would have been just the ticket to manage such a large dataset. I fired up qgis and started looking for the "create GeoDB" function. Well, as it turns out, Geodatabases are a feature proprietary to ArcGIS, and ESRI does not embrace the sharing of functionality and open data standards which are common in the open source community. I was stunned to discover the Geodatabases as they exist in ArcGIS, are unique to ESRI products, and that a GeoDB cannot be access by any other application.

My assumption was that any database used to store spatial data was a Geodatabase. I was less than thrilled to learn that my relatively extensive experience working with Geodatabases would not apply to spatial databases in any other application... and every other spatial data application utilizes a common db protocol and ESRI alone does not embrace. Humph!

Soon I found myself in the world
of painful, general error messages. Help me, please!


How is a spatial database different from a "capital G" Geodatabase? After all, they serve largely the same function, in that they both are a fast way to store large amounts of spatial data in a hierarchical structure. ESRI's database solution is designed from the ground up to work with spatial data. It's very much a black-box solution - you give it data, and it lets you use that data in ArcGIS. A user does not have visibility into the configuration and implementation of the database - this is all handled under the hood by ArcGIS. As a user of open source GIS software, I learned that I would have to utilize the power of databases with my spatial data, I would have to roll my own database solution.

I have only a very general idea of how databases work: deploy the database, import your data, and then reference the database in an application to view and modify the data. So far, I have managed to get the database instance installed on my local machine. I selected POSTgres as my database system, and installed the POSTgis plugin to add spatial functionality to the database system. I used the included tool to store data (a single shapefile) in the database, and access that data from qgis. My understanding is that the main value of a database for spatial data comes in that data does not have to be contained within the shapefile format, but instead data of different types can be easily cross-referenced which allows for powerful analysis. Additionally, databases are much faster than shapefiles when manipulating large datasets, and are less prone to corruption during data writes.

I am still confused about the following:
  • How does one relate shapefiles to each other in a spatial database?
  • Can shapefiles of similar features (i.e. the same feature class) be combined upon import?
  • What is the best way to import bulk geodata into a spatial database?
  • How can I be sure data attributes are preserved?
  • How do I move data from my database back to a shapefile for transfer to a collegue?
  • Shapefiles are a great way to share data - is there a analog for sharing data from a database, or is export  to shapefile the best method?
  • How can projections and coordinate reference issues best be handled?
  • How do I modify data in a database (the db equivalent of editing a shapefile?)
  • Do databases support topologically-aware feature editing?
As I continue to tinker and learn, I hope to answer most if not all of the above questions. In the mean time, if you have any suggestions, please do let me know!

10 June 2013

Sailing on the San Joaquin River

With summer in full swing, there is no better time to get out for a sail! I recently went for a day cruise on the San Joaquin River in the heart of the region known locally as the delta. The winds were very light in the morning, so we had some time to float around and work on our tans, but thankfully a stiff breeze came in around 3 PM.

Overall, we covered 12 nautical miles, or about 14 miles, which is pretty good when you consider that we spent a lot of time sitting and waiting for a breeze.

Leaving Delta Sailing School's dock in Seven Mile Slough.

We got the sails up and made no progress upwind....

So we headed downwind for a nice cruise. 

Unfortunately, this meant we had to head
back upwind, requiring many tacks.

We finally got some nice log runs in before calling it a day.