Place not Space; Geo without Maps
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Place not Space; Geo without Maps

  • 5,631 views
Uploaded on

"Place not Space; Geo without Maps"; presented on October 1st. 2009 at FOWA (Future of Web Applications) London.

"Place not Space; Geo without Maps"; presented on October 1st. 2009 at FOWA (Future of Web Applications) London.

More in: Technology , Sports
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,631
On Slideshare
5,630
From Embeds
1
Number of Embeds
1

Actions

Shares
Downloads
52
Comments
0
Likes
7

Embeds 1

http://www.slideshare.net 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • The placeDetails container defines a place – there’s one per place found – it holdsWOEID – the unique identifier for the placetype – the place type name for the placename – the fully qualified name of the placecentroid – the centroid coordinatesmatchType – the type of match (0=text/text & coordinates, 1=coordinates only)weight – relative weight of the place within the documentconfidence – confidence that the document mentions the place
  • WOEID – list of WOEIDs referencing the placestart & end – index of first and last character in the place reference or -1 if type is XPathisPlaintextMarker – flag indicating if the reference is plain texttext – the actual place referencetype – type of reference – plaintext, Xpath, Xpathwithcountsxpath – xpath of the reference
  • So now we have the places, their references and their WOEIDs we can easily hook into services which understand WOEIDsSuch as FlickrBecause not only does Flickr love you, it also knows about WOEIDs, as this YQL fragment shows
  • But what about those services that don’t speak WOEID fluently?Looking back at the place definitions, we have WOEIDs.Well each WOEID has metadata attributes associated with it, such as the centroid of a place with the longitude and latitudeAnd because geo should be technologically agnostic, so must we, so with these coordinates we can use other services, such as Google Earth

Transcript

  • 1. Place not Space; Geo without MapsFOWA London, October 2009Gary Gale, Yahoo! Geo Technologies
  • 2. PLACES, PEOPLE and THINGS
    atibens on Flickr : http://www.flickr.com/photos/atibens/2616899638/
  • 3. Knowing where our users are, and the places that are important to them
    Knowing the geographic context of everything we index, manage and publish
    Knowing
    geographic locations, and the names of places
    We Connect
    Places, People and Things
  • 4. SOME NUMBERS
    KoenVereeken on Flickr : http://www.flickr.com/photos/koenvereeken/2088902012/
  • 5. 85% of all data stored is unstructured
    This doubles every 3 months
    80% of all data contains a geo reference
    Source: Gartner Group
    Mr Faber on Flickr : http://www.flickr.com/photos/mrfaber/247946146/
  • 6. MINE THAT CONTENT
    tjblackwell on Flickr : http://www.flickr.com/photos/tjblackwell/3652375290/
  • 7. Content / URL
    +
    =
    Places & References
  • 8. http://www.vicchi.org/speaking
  • 9. UNLOCK PLACEMAKER
    https://developer.apps.yahoo.com/wsregapp/
    bohman on Flickr : http://www.flickr.com/photos/bohman/210977249/
  • 10. http://wherein.yahooapis.com/v1/document
  • 11. Placemaker Parameters
    appid
    100% mandatory
    inputLanguage
    en-US, fr-CA, …
    outputType
    XML or RSS
    documentContent
    text to geoparse
    documentTitle
    optional title
    documentURL
    URL to geoparse
    documentType
    MIME type of doc
    autoDisambiguate
    remove duplicates
    focusWoeid
    filter around a WOEID
  • 12. WOEIDs
    stevefaeembra on Flickr : http://www.flickr.com/photos/stevefaeembra/3567750853/
  • 13. Unique
    Permanent
    Global
    Language Neutral
    London = Londra = Londres = ロンドン
    United States = États-Unis = StatiUniti = 미국
    Ensures that geography can be employed consistently and globally
    straup on Flickr : http://www.flickr.com/photos/straup/3504862388/
  • 14. GeoPlanet
    A Global Location Repository
    Names + Geometry +Topology
    WOEIDs for
    • cities and towns
    • 15. postal codes, airports
    • 16. admin regions, time zones
    • 17. telephone code areas
    • 18. marketing areas
    • 19. points of interest
    • 20. colloquial areas
    • 21. neighbourhoods
    woodleywonderworks on Flickr : http://www.flickr.com/photos/wwworks/2222523978/
  • 22. // POST to Placemaker
    $ch = curl_init();
    define('POSTURL', 'http://wherein.yahooapis.com/v1/document');
    define('POSTVARS', 'appid='. $key.'&documentContent='.urlencode($content).
    '&documentType=text/plain&outputType=xml'.$lang);
    $ch = curl_init(POSTURL);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, POSTVARS);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $placemaker = curl_exec($ch);
    curl_close($ch);
  • 23. PLACES
    that_james on Flickr : http://www.flickr.com/photos/that_james/496797309/
  • 24. <placeDetails>
    <place>
    <woeId>44418</woeId>
    <type>Town</type>
    <name>
    <![CDATA[London, England, GB]]>
    </name>
    <centroid>
    <latitude>51.5063</latitude>
    <longitude>-0.12714</longitude>
    </centroid>
    </place>
    <matchType>0</matchType>
    <weight>1</weight>
    <confidence>10</confidence>
    </placeDetails>
    One place for WOEID 44418
  • 25. REFERENCES
    misterbisson on Flickr : http://www.flickr.com/photos/maisonbisson/117720946/
  • 26. <reference>
    <woeIds>44418</woeIds>
    <start>1079</start>
    <end>1089</end>
    <isPlaintextMarker>1</isPlaintextMarker>
    <text><![CDATA[London, UK]]></text>
    <type>plaintext</type>
    <xpath><![CDATA[]]></xpath>
    </reference>
    <reference>
    <woeIds>44418</woeIds>
    <start>1116</start>
    <end>1126</end>
    <isPlaintextMarker>1</isPlaintextMarker>
    <text><![CDATA[London, UK]]></text>
    <type>plaintext</type>
    <xpath><![CDATA[]]></xpath>
    </reference>
    Two references for WOEID 44418
    Two references for WOEID 44418
  • 27. // turn into an PHP object and loop over the results
    $places = simplexml_load_string($placemaker, 'SimpleXMLElement',
    LIBXML_NOCDATA);
    if($places->document->placeDetails){
    $foundplaces = array();
    // create a hashmap of the places found to mix with
    // the references found
    foreach($places->document->placeDetails as $p){
    $wkey = 'woeid'.$p->place->woeId;
    $foundplaces[$wkey]=array(
    'name'=>str_replace(', ZZ','',$p->place->name).'',
    'type'=>$p->place->type.'',
    'woeId'=>$p->place->woeId.'',
    'lat'=>$p->place->centroid->latitude.'',
    'lon'=>$p->place->centroid->longitude.'’
    );
    }
    }
  • 28. // loop over references and filter out duplicates
    $refs = $places->document->referenceList->reference;
    $usedwoeids = array();
    foreach($refs as $r){
    foreach($r->woeIds as $wi){
    if(in_array($wi,$usedwoeids)){
    continue;
    } else {
    $usedwoeids[] = $wi.'';
    }
    $currentloc = $foundplaces["woeid".$wi];
    if($r->text!='' && $currentloc['name']!='' &&
    $currentloc['lat']!='' && $currentloc['lon']!=''){
    $text = preg_replace('/s+/',' ',$r->text);
    $name = addslashes(str_replace(', ZZ’,
    $currentloc['name']));
    $desc = addslashes($text);
    $lat = $currentloc['lat'];
    $lon = $currentloc['lon'];
    $class = stripslashes($desc)."|$name|$lat|$lon";
    $placelist.= "<li>".
    }
    }
  • 29. select * from flickr.photos.info where photo_id in
    (select id from flickr.photos.search where woe_id=44418)
    and license=4;
  • 30. <placeDetails>
    <place>
    <woeId>44418</woeId>
    <type>Town</type>
    <name>
    <![CDATA[London, England, GB]]>
    </name>
    <centroid>
    <latitude>51.5063</latitude>
    <longitude>-0.12714</longitude>
    </centroid>
    </place>
    <matchType>0</matchType>
    <weight>1</weight>
    <confidence>10</confidence>
    </placeDetails>
    ragewear on Flickr : http://www.flickr.com/photos/ragewear/3367122893/
  • 31. http://developer.yahoo.com/yui/
  • 32. http://developer.yahoo.com/yql/
  • 33.
  • 34.
  • 35. THE INTERNET IS BROKEN
    Nesster on Flickr : http://www.flickr.com/photos/nesster/3168425434/
  • 36. // load the URL, using YQL to filter the HTML
    // and fix UTF-8 nasties
    $url = 'http://www.vicchi.org/speaking';
    $realurl = 'http://query.yahooapis.com/v1/public/yql’.
    '?q=select%20*%20'.
    'from%20html%20where%20url%20%3D%20%22'.
    urlencode($url).'%22&format=xml';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $realurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $c = curl_exec($ch);
    curl_close($ch);
    if(strstr($c,'<')){
    $c = preg_replace("/.*<results>|</results>.*/",'',$c);
    $c = preg_replace("/<?xml version="1.0"".
    " encoding="UTF-8"?>/",'',$c);
    $c = strip_tags($c);
    $c = preg_replace("/[ ? ]+/"," ",$c);
    }
  • 37. MINOR ANNOYANCES
    swooshthesnail on Flickr : http://www.flickr.com/photos/swooshthesnail/3281681399/
  • 38. 50,000 BYTES
    ASurroca on Flickr : http://www.flickr.com/photos/asurroca/147049402/
  • 39. X
    NO JSON
  • 40. POST NOT GET
    sludgegulper on Flickr : http://www.flickr.com/photos/sludgeulper/2645478209/
  • 41. WANT TO KNOW MORE?
    selva on Flickr : http://www.flickr.com/photos/selva/24604141/
  • 42. Earth
    http://isithackday.com/hacks/placeearth/
    http://github.com/codepo8/PlaceEarth
  • 43. http://developer.yahoo.com/geo/placemaker
  • 44. http://developer.yahoo.com/geo/geoplanet
  • 45. http://slideshare.net/vicchi
  • 46. THANK YOU FOR LISTENING
    quinn.anya on Flickr : http://www.flickr.com/photos/quinnanya/3118626057/
  • 47. www.ygeoblog.com
    twitter.com/yahoogeo
    twitter.com/vicchi