Integggrating Geo Services with ArcGIS Applications

@AL_Laframboise &@& @agup Agenda

• Geo Services

• Geolocation

• Integrating with services

• Social networking services

• Future challenges Geo Services

Any service that provides “geo” or “location-based” functionality

Help solve the geolocation problem Geolocation

Science of using applications, services & devices to solve a locationlocation--basedbased problem

1. Where we are (location) • Geoggpraphic coordinates • Areas (polygons)

2. What’ s around us • People • Places (geog rap hic features) • Businesses “Near me now” presents new challenges…

1. What is near me now?

2. Who’s near me now?

3. How do I find them?

4. What they saying? New dimensions of geolocat io n app licat io n development 5. How can I provide feedback?

6. How can I monetize it? Types of Geo Services

• Traditional – Mapping – ArcGIS Online, Bing, Google, Yahoo – Geocoding – ArcGIS Online, Bing, Google, Yahoo – Places (POI) ––GeoAPIGeoAPI,, GeoNames,GeoNames, Yahoo! GeoPlanet (WOEIDs)

• LocationLocation--basedbased – Navigation and routing – Tracking – friends, family , traffic , vehicles – Information – yellow pages, advertising, emergency, weather

• Social Networking and Crowdsourcing – Find and follow people around you – Twitter, Gowalla,Gowalla, Latitude – Rate and comment -Yelp,- Yelp, NextStop Geo Services in Action

Finding your Location Satellite and Antenna Triangulation

• GPRS

• WiFi

• GPS

More options, more location aware devices HTML5 Geocode

• W3C Geo API - embedded into Firefox 3.5 and later

• Based on Google Location Services – Location providers (WiFi(WiFi,, IP…)

• Inoperative until mandatory optopt--inin

• TfUTerms of Use – Mozilla Privacy Policy, Google Privacy Policy

navigator.geolocation.getCurrentPosition(function(position) do_something( position.coords.latitude, position.coords.longitude ); });

Windows 7 Sensor and Location Platform

1. Find or build a location sensor 2. Enable location on your Windows 7 platform 3. Consume Windows Location API ( .NET 4 .0 or C++)

.NET 4.0 and Visual Studio RC 2010 Integrating with Services Consuming Services – ArcGIS Explorer Examples

• Bing • Google • Panaramio • Yahoo • Yellow Pages • Image

ArcGIS Explorer Labs Programming with services

1. Locate the service

2. Review license, limitations and security requirements

3. Determine type ((GeoRSSGeoRSS,, REST, SOAP)

4. Resource representation (XML, , JSON…)

5. Develop the application Accessing ArcGIS Services: Web APIs

1. Access the endpoint (service) 2. Execute Async request 3. Handle response

Silverlight Example

Locator locatorTask = new Locator("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" + "Locators/ESRI_Geocode_USA/GeocodeServer"); locatorTask.AddressToLocationsCompleted += LocatorTask_LocationsCompleted; private void LocatorTask_LocationsCompleted(object sender, AddressToLocationsEventArgs args) { if (args.Results.Count > 0) … Accessing GeoRSS Services: YahooWeather/Traffic

1. Access endpoint URL (no token) 2. Load XML syndication and parse ((DataSetDataSet)) 3. Convert to ArcGIS types

http://api.local.yahoo.com/MapsService/rss/trafficData.xml?appid=YahooDemo&zip=

private void YahooWeather() { DataTable dataTable = DataSource(txtYahooWeather.Text + _zipCode, "Yahoo Weather"); … CreateGraphic(lon, lat, title, description, symbol); }

private DataTable DataSource(string URL, string serviceName) { DataSet ds = new System.Data.DataSet(); ds.ReadXml(URL); … longIndex = dataTable.Columns.IndexOf("long"); latIndex = dataTable.Columns.IndexOf("lat"); … Accessing Services: Bing Geocoder

1. Request token (requires account) 2. Access the endpoint (generate classes) 3. Execute Async request 4. Handle the callback 5. Convert data to ArcGIS types

http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc

private void btnGeocode_Click(object sender, EventArgs e) { _bingggyGeocoder.BingGeocodeAsync(txtQueryygString.Text); }

void _bingGeocoder_BingGeocodeCompleted(object sender, GeocodeResultEventArgs e) { AddNote(new Note(result.Name, result.ArcGISExplorerPoint)); }

Consuming REST - Javascript

1. Initialize the request 2. Add an event listener 3. Execute the request – GET/POST 4. Handle the callback 5. Parse results - JSON, XML, KML, etc 6. Remove the event listener

http://search.twitter.com/search.json?q=devsummit

esri.request({ url: xhrUri, handleAs: "json", callbackParamName: "callback", load: showFeed, error: handleError });

Accessing resources across domains

GET/POST

xhrRequest Web app

GET/POST

Web app X No cross-domain file Cross-domain and proxy solutions

GET/POST

Web app

GET/POST

Web app Proxy GET

Social Networking and Crowdsourcing Services Twitter

MicroMicro--blogging,blogging, messaging and networking platform

• Post messages (status updates) • Follow others • Others can follow you

Service for sharing information

Anyone, Anything, Anywhere, Anytime, Any Device Examples of status messages - “tweets”

I noticed a brush fire off the 10FWY south of the 91FWY interchange. Anyone dispatched yet? #LAFires

Traffic accident off of the 38FWY near Big Bear Lake. #SoCalTraffic

Anyone know where there’s still parking available for the baseball game tonight? #OregonEvents

Pseudo‐geotweets Anatomy of a tweet

What’s happening?

Downtown LA. Traffic accident on I10. Backed up for 34.0636 miles. Anyone know how the I60 is? #Traffic ‐117.5922

To whom?

Geolocation? Twitter Service APIs

1. Search – ATOM or JSON

2. REST

3. Streaming

Free, si mpl e, access f rom many cli ent s (HTTP)

Authentication, rate limiting, whitelisting

Learn more about the Twitter API GeoTagging Tweets

• Applications can append coordinates

• Users must geo-enable (opt-in) accounts string url = http://api.twitter.com/statuses/update.xml; string status = “At the Devsummit learning lots of cool things… #devsummit”; string request = string.Format("lat={0}&long={1}&status={2}", lat, lon, status);

‘ Geolocation enabled 34.056758 -117.196006

‘ Geolocation not enabled

Learn more about geotagging tweets Geo-components of a status message

Tue Mar 02 16:49:59 +0000 2010 9881885810 At the Devsummit learning lots of cool things… #devsummit <a href="http://tinyurl.com/agx" rel="nofollow">ArcGIS Explorer</a> 15700862 Allan Laframboise AL_Laframboise Redlands, California http://a1.twimg.com/profile_images/669580624/al.jpg 540 546 Pacific Time (US & Canada) http://a3.twimg.com/profile_background_images/42048639/Redbull_Ram page.jpg f al se true false 615 en 34.056758 -117.196006 Search for and Geocode Tweets

MultiMulti--stepstep process if (status.IsGeoTagged) { point = status.GetGeoPoint; 1. Geotag } else if (status.HasMobileCoords) { point = status.GetMobilePoint; 2. Mobile Location } else – iPhoneiPhone,, UT, -123-123°45°… { point = Geocode(status.Location); } 3. Location ( geocode) – Location e.g. New York Demo Development Considerations

• Authentication –oAuth– oAuth,, xAutho vs Basic authentication

• Rate limiting

• Whitelisting

Recent a dditi on of GdGeocode/Reverse geocoding support ! Use Cases: Twitter + Geolocation

• Pull information (Geocoding(Geocoding)) – News – get realreal--timetime news/information by location and topic – Trends – events,,g can be location based e.g. flu trends…

• Push information (Geotag(Geotag)) – News, weather, traffic, incidents…

Learn more about tweeting your location Final Examples ArcGIS Explorer Twitter Extension

• Features – Geocode twitter data – GGgeoTag – Search and search by radius – Build and share tweet maps (AGOL)

• Technology – AGX Desktop – .NET AddAdd--inin – AGOL (base maps, sharing) – GNGeoNames – Twitter (REST, Search, XML, oAuth)

Download AGX Extension

ArcGIS JavaScript Twitter Client

• Features – Place finder – Twitter opp(y)en search (by radius) – Geocoding – Drivetime polygons – EttExport to ..csvcsv

• Technology – Web client – ArcGIS API for JavaScript, Dojo – AGOL, ArcGIS Server , GP and Geometry Service – Twitter – Bing – Proxy

Developer Tips

• JavaScript single threaded

• Componentize your applications

• Create DOJO classes

• Use a proxy ArcGIS API for Flex

• Features – Twitter search by radius – Automated search – Local caching and filtering – Clustering

• Technology – Rich Internet Application ( RIA) – Sample Flex Viewer Widget – ArcGIS API for Flex – Twitter (Search API) – Basic authentication, encryption

ArcGIS Desktop Add-in - TweetBase

• Features – Data mining application – Log twitter data – Geocode – Full ArcGIS analyses/processing

• Technology – Desktop/Server – .NET AddAdd--inin – Twitter – Bing – ArcGIS Server publishing

Future challenges

• Standardization – different databases and representations

• Accuracy – geocoding vs geotagging

• Management – crowdsourced data with existing data

• GeolocationGeolocation--GISGIS integration services and applications

• Geolocation privacy and security

• Free vs fee - monetization Summary

• Geo Services empower Geolocation

• Many devices and technologies to choose from

• Different ways to integrate services with ArcGIS

• Social networking services provide geolocation support

• Crowdsourced data can be extremely valuable

Let’s build innovative GIS applications and services to help solve the Geolocation (near me now) problem.