Knowing your location in the world is a game changer. Besides simply understanding where you are physically, location is the key to a tremendous amount of value and supporting information.
Okay so your coordinates are X,Y, who cares, right? Well, with a simple set of coordinates, you can find local weather and forecasts, census insights, crime stats, relative motion, underlying soil geography, bodies of water, nearby businesses, provide navigation, customer insights, create location based alerts, asset recovery, real-time real-world gaming, etc, etc. Knowing your location is the difference between simply having data, and having data with a global and human context.
Excited?! "How do I get this precious resource?" You ask? I'll tell you! It's easy!How it works
You've probably heard of GPS, well we're not going to use that today. GPS is awesome, but the signals are weak and don't reach indoors or bounce around too much in dense urban environments. Lots of companies figured this out a while back, and realized that your Wi-Fi router at home (with a range of 100-300 feet) doesn't move very often. If only we could record the location of those Wi-Fi routers, then anything that could see a Wi-Fi network could figure out where it was!
Using this stored location, services can perform trilateration to make a pretty decent guess about where you are.
WiFi assisted geolocation was such a great idea that all the major mobile phone providers started collecting this data and using it, companies literally started driving GPS-enabled trucks that record Wi-Fi router locations, and your browser already uses these systems to find itself with a scan for nearby networks thanks to the HTML5 Geolocation Standard. So let's take a minute and thank them for building a neat thing. Thanks!
We're going to craft a message that any standard browser geolocation service can understand. Since Google has an awesome geolocation service we can use, and they make it easy to get an API key, let's start there!
But how can I find my Particle Photon, you ask?
If you're using the CLI, save those hook files to JSON, add your API keys and run:
particle webhook create google_locate.json
If you're using the web console, creating the hook will look more like this:
After you create the hook and flash the firmware, you should start seeing results like this in your event feed / log view:
If you're watching the serial output of your photon, you'll see something like this:
Got location back! 25.0000, -71.0000, 100 You're on a map! https://www.google.com/maps/place/25.0000,-71.0000
Enjoy and have fun! :)