wordcamp columbus - location based integrations
Post on 09-May-2015
4.079 Views
Preview:
TRANSCRIPT
WordCampCB
Location Based Services
Hash Tags and Whatnot
• #wccb – WordCamp Columbus
•#wccb #lbs – LBS Session
Introductions
50% of the United States population lives
within a 500 mile radius of Columbus.
Who are You and Why are You here?
• Understanding• Ideas or Insights• Technologies
Introductions
@LukePilon• Software Architect• WordPress • 4 Years as a User• 2 Years Designing Software• Community Involvement
• CEO at Mobiah• AC/DC, Lolcats, and the 80s
Movies
Mobiah, Inc• Services, Software, Data• Acquisition and Loyalty• GPL Software• Producers of GeoPosty• 3 Plugins in the .ORG
Repository
Content for Today
• Orientation – What is a LBS• Logic – When to leverage LBS• Methods – Access User Location• Basic Delivery – How to Deliver a Simple LBS Loop
What the what
• Location-Based Services refers to a broad range of services that are based on (or enhanced by) information about the physical location of a user and/or device.
• $10 billion in revenue by 2016*
http://www.businesswire.com/news/home/20110609006492/en/Strategy-Analytics-Cellphone-Privacy-Concerns-Short-Term-Barrier
What is a LBS?
They are a LBS and you are a LBS
Everyone’s a LBS, S, S, S….
LOCATION BASED SERVICESThe time and place to use them.
Location is Important
• What level of location do you actually need before your user starts to see value?• Continent • Nation• State• City• Block
Use Cases
• Ad Targeting• Digital Rights Management• Localizing Content• Fraud Prevention
Use Cases and You
• Providing Specific Deals, Moving Inventory• Protecting Your Content Rights / Restrictions• Enriching the User’s Experience • Blocking Unauthorized Users
Food For Thought on LBS
• 20% of all Google Searches Performed on a Desktop Involve Location
• 40% of all Google Searches Performed on a Mobile Devices Involve Location
ACCESSING USER LOCATION
Implementations
• IP Geolocation•HTML5
IP GEOLOCATIONYou have an IP Address & we know geographically where that is.
IP GEO Properties
• Always On• Static in Nature• No Permission• 25-50 Mile Localization
IP GEO LIBRARIESHow it gets done
• Agreements with ISPs• AppSourcing the Crowd• Mad Scientists with Mad Bots• Wifi Libraries
IP Geo Libraries
Service Providers
• IP2Location• MaxMind• Quova, a Neustar Service
Libraries in General
• 4B IP Addresses• ~ 20% Actively Changing• Accessible via DB, API
Plugins that do IP Geo
• GeoPosty 4,084 Downloads – 4.25 Stars• Quova IP Technology
• IP2Location Tags – 468 Downloads – 5 Stars• IP2Location IP Technology
• WP Geolocation – 1,120 Downloads – 2.75 Stars• MaxMind IP Technology
Plugin Features
• Shortcodes• Preconfigured Widgets• Redirection• 3rd Party LBS Integrations
Obligatory CODE SLIDE
<?php echo do_shortcode('[geocity]'); ?>
[geolongitude] and [geolatitude]
HTML5 GEOLOCATIONPermission based access to users’ location.
HTML5 Background
• A collection of HTML standards being brought into adoption.
• Not something that’s going to show up all at once, not even on your birthday. #sorry
• Many features are already in adoption with current browsers.
HMTL5 Geolocation
• A singular feature of the HTML5 Standard• Off By Default• Can be coded as dynamic• Permission Based, Error handling can be difficult• ~ 12 Meter Localization
HTML5 Geolocation APIHow it Gets Done
•Cell Tower Triangulation•Device GPS• IP Geo Libraries
HTML5 Geolocation API
• IE – 9.0+• Firefox – 3.5+• Safari – 5.0+• Chrome – 5.0+• Opera – 10.6• iPhone – 3.0+• Android – 2.0+
http://diveintohtml5.org/geolocation.html
Browser Adoption
24.90%
42.40%
25.90%4.00%
2.40%
% of Usage
Internet ExplorerFirefoxChromeSafariOpera
IE Support #Fail
IE Supported
IE 9
IE 6 - 8
Firefox Support
FF Support
FF 3.5 - 4
FF 3
A Safe AssumptionBefore the Opt-In
1+ out of 2 Users
Can Currently Support HTML5 Geolocation
Google Analytics Will Set You Free
Plugins
Obligatory CODE SLIDE
• function get_location() { navigator.geolocation.getCurrentPosition(show_map); }
// Callback function once location has been granted• function show_map(position) { var latitude =
position.coords.latitude; var longitude = position.coords.longitude; // let's show a map or do something interesting! }
STAND AND DELIVERYou, or your client, as an LBS
Best Practices
• Location, Location, Location with Balance, Balance, Balance
• Give the User A Logical Exit• Don’t Be Evil, Get Consent, Allow Record Removal• Privacy Policy FTW
Never, Never Never Ever
• Hello [geocity]! Welcome to my site!
• #FAIL #FAIL #FAIL #FAIL
Super Simple LBSing.
• Step 1: Put Your Content to City Categories• Step 2: Load The User’s Location Into Shortcodes• Step 3: Get Loopy
The Basic Geo Loop
<?php
$city = do_shortcode('[geocity]');
$args = array('category_name' => $city);
$myCityQuery = new WP_Query($args);
if ($myCityQuery->have_posts()): while ($myCityQuery->have_posts()): $myCityQuery->the_post();
//post stuff
endwhile; endif;
?>
BONUS MATERIAL
CODE – Useful Functions
// http://snipplr.com/view/2531/calculate-the-distance-between-two-coordinates-latitude-longitude/
function getGeoDistance($lat1, $lng1, $lat2, $lng2, $miles = true)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797; // mean radius of Earth in km
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$km = $r * $c;
return ($miles ? ($km * 0.621371192) : $km);
}
CODE – Useful Functions
// http://www.hashbangcode.com/blog/search-engine-spider-detection-php-258.html
function geoSpiderDetect() {
$agentArray = array("ArchitextSpider", "Googlebot", "TeomaAgent",
"Zyborg", "Gulliver", "Architext spider", "FAST-WebCrawler",
"Slurp", "Ask Jeeves", "ia_archiver", "Scooter", "Mercator",
"crawler@fast", "Crawler", "InfoSeek Sidewinder",
"almaden.ibm.com", "appie 1.1", "augurfind", "baiduspider",
"bannana_bot", "bdcindexer", "docomo", "frooglebot", "geobot",
"henrythemiragorobot", "sidewinder", "lachesis", "moget/1.0",
"nationaldirectory-webspider", "naverrobot", "ncsa beta",
"netresearchserver", "ng/1.0", "osis-project", "polybot",
"pompos", "seventwentyfour", "steeler/1.3", "szukacz",
"teoma", "turnitinbot", "vagabondo", "zao/0", "zyborg/1.0",
"Lycos_Spider_(T-Rex)", "Lycos_Spider_Beta2(T-Rex)",
"Fluffy the Spider", "Ultraseek", "MantraAgent","Moget",
"T-H-U-N-D-E-R-S-T-O-N-E", "MuscatFerret", "VoilaBot",
"Sleek Spider", "KIT_Fireball", "WISEnut", "WebCrawler",
"asterias2.0", "suchtop-bot", "YahooSeeker", "ai_archiver",
"Jetbot"
);
Parting Remarks
Imagine 2015
Parting Remarks
Go do something excellent.
top related