530 likes | 657 Views
Location Based Services Without the Cocoa. Institutional Web Managers Workshop , 12 th July 2010 Ben Butchart, Murray King. This work is licensed under a Creative Commons Attribution-NonCommercial 2.0 England & Wales License . But note caveat. Introduction. Digimap Geo Mobile Scoping study
E N D
Location Based Services Without the Cocoa Institutional Web Managers Workshop , 12th July 2010 Ben Butchart, Murray King This work is licensed under a Creative Commons Attribution-NonCommercial 2.0 England & Wales License. But note caveat.
Introduction • Digimap Geo Mobile Scoping study • Technical evaluation • User Engagement • Digimap pilot (in AppStores soon! Maybe?) • Focus today for workshop on technical evaluation • Our blog: http://mobilegeo.wordpress.com/ • Prezi mobile scoping study http://prezi.com/jllhxm1zzpdm • Final project report: http://mobilegeo.files.wordpress.com/2010/07/digimap-mobile-scoping-study-final-project-report1-1.doc • Thanks to JISC for funding.
Workshop outline • Requirements for LBS in teaching and learning. • Technology concepts overview. Native, Mobile Web, Hybrid, HTML5 Geolocation, HTML5 Canvas, HTML5 Local Storage . • Building your own mobile mapping client tutorial. • Build your own mobile mapping client - practical exercise . • HTML5 Canvas and LBS. • Building your own AR app with Layar tutorial (10 mins). • Building your own AR app with Layar practical exercise ( 10 mins ). • Web Approaches pros and cons. • Why Native? • Sustainability
Informal Requirements “…delivering a map to a smart phone device within a range of educational contexts including field trips in remote areas, where network connectivity may be limited. It was also anticipated that the application might assist data collection, for example, taking pictures of rocks during a field study.”
Technical Requirements • Location: Must be able to obtain a location fix through device sensors (GPS). • Touch: Must be able to take advantage of touch screen user gestures (e.g pinch to zoom in and out) • Sensors: Should be able to access sensors and gadgets such as the camera, accelerometer and compass. • Local Storage: Should be able to cache data so that application can be used in remote areas with limited connectivity. • Portable: Should work on a range of devices.
Mobile App DevelopmentApproaches • Native: programming languages and tools are unique to a particular device or operating system. • Mobile Web: applications are delivered through the mobile web browser. • Hybrid: a lightweight web browser is integrated into a skeleton native app.
Technologies : Mobile Web • HTML5 Geolocation: web based access to location sensors. • HTML5 Canvas: manipulate images at pixel level • HTML5 Local Storage: SQLite database embedded in browser. • HTML5 Cache: Cache web resources such as images, web pages and scripts. • CSS • Flash ( not supported by iPhone) • AR browsers – Layar / wikitude etc/
Technologies : Native • iPhone: Objective-C and Cocoa Touch. • Blackberry: RIM • Symbian (Nokia): Symbian Foundation C libraries. • Android: Java (mostly) • AR – Wikitude
Technologies : Hybrid • PhoneGap • W3C Widgets • QuickConnect • Rhodes • Appcelerator Titanium
Memory Check… • HTML5 Geolocation: web based access to location sensors. • HTML5 Canvas: manipulate images at pixel level • HTML5 Local Storage: SQLite database embedded in browser. • HTML5 Cache: Cache web resources such as images, web pages and scripts. • Native: programming languages and tools are unique to a particular device or operating system. • Mobile Web: applications are delivered through the mobile web browser. • Hybrid: a lightweight web browser is integrated into a skeleton native app.
Build Your Own mobile Map App in 10 minutes • Yes, really. 10 minutes. • We need some maps – Google? • No. Everyone does that. We’ll use some OS Open Data instead. • We’ll use the OpenLayers API • And Geolocation API
Digimap Open Stream ( New Edina Service) Edina provide WMS Service Ordnance Survery OpenData You can register for your API key here (free and unrestricted use for ac.uk) http://osopen.edina.ac.uk
Digimap Open Stream WMS Ordnance Survey OpenData maps Miniscale 1:250000 Colour Raster Vector Map District (raster) OS StreetView
Digimap Open Stream WMS example http://osopen.edina.ac.uk/openstream/wms?REQUEST=GetMap&SERVICE=WMS &VERSION=1.1.1 &BBOX=325000,674000,326000,675000 &WIDTH=460 &HEIGHT=640 &SRS=EPSG:27700 &FORMAT=image/png &LAYERS=osfree &CACHE=false &TOKEN=YOUR_KEY
Digimap Open Stream WMS example http://osopen.edina.ac.uk/openstream/wms?REQUEST=GetMap&SERVICE=WMS &VERSION=1.1.1 &BBOX=325000,674000,326000,675000 &WIDTH=460 &HEIGHT=640 &SRS=EPSG:27700 &FORMAT=image/png &LAYERS=osfree &CACHE=false &TOKEN=YOUR_KEY
Digimap Open Stream OpenLayers Example http://osopen.edina.ac.uk/help/map
Digimap Open Stream OpenLayers Example Code Example OpenLayers code here: http://osopen.edina.ac.uk/help/map
Digimap Open Stream OpenLayers Example Code var os_options = { token: apikey, format: "image/png", layers: "osfree", cache: true }; map = new OpenLayers.Map('map', {controls: [], projection: new OpenLayers.Projection("EPSG:27700"), units: "m", maxExtent: bounds, resolutions: [1763.889,352.778,176.389,88.194….0.882,0.441]} ); var osfree = new OpenLayers.Layer.WMS( "Edina OS OpenData WMS","http://osopen.edina.ac.uk/openstream/wms", os_options ); map.addLayers([osfree]);
OpenLayers Example: convert latlong <script type="text/javascript" src='coordomatic1.js'></script> var natgrid = new Edina.EPSG_27700() ; var latlong = natgrid.toLocalSystem(55.93682192813903 , -3.180231279418976 var lonLat = new OpenLayers.LonLat(latlong[1], latlong[0]) ; map.zoomTo(10) ; map.setCenter(lonLat);
What’s different in mobile OpenLayers? Use of Geolocation API if(typeof(navigator.geolocation) != "undefined"){ navigator.geolocation.getCurrentPosition(foundLocation, handleError); } Some stylesheet stuff <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="viewport" content="minimum-scale=1.0, width=device-width, ..> Touch Controls <script type="text/javascript" src="touch3.js" ></script> this.touchhandler = new TouchHandler(map, 2);
Geolocation API if(typeof(navigator.geolocation) != "undefined"){ navigator.geolocation.getCurrentPosition(foundLocation, handleError); } function foundLocation(position) { lon = position.coords.longitude; lat = position.coords.latitude; var lonLat = new OpenLayers.LonLat(latlong[1], latlong[0]) ; map.setCenter(lonLat); } function handleError(positionError) { $("#debug").append("<p>" + "Attempt to get location failed: " + positionError.message + " </p>") ; };
HTML5 Canvas • Manipulate images at pixel level • Can draw on images and retrieve pixel data http://mobilegeo.wordpress.com/2009/11/04/ html5-canvas-for-mobile-apps/
HTML5 Canvas 1. Create canvas element <canvas id="canvasimg" width="250" height="250">This demo uses the HTML canvas object. </canvas> 2. Draw image on canvas var img = new Image(255,255) ;img.src = "http://.../testimg/test1.png" ;var newCanvas = document.getElementById("canvasimg") ;var ctx = newCanvas.getContext("2d") ;var newimg = ctx.drawImage(img, 0, 0); http://mobilegeo.wordpress.com/2009/11/04/ html5-canvas-for-mobile-apps/ Short url: http://delivr.com/11cic
HTML5 Canvas 3. Draw graphic on canvas image if ( drawMode == true ){var xy = getxy(e, newCanvas ) ; ctx.fillRect(xy.x,xy.y,5,5) ;return ;} http://mab.edina.ac.uk/ testimg/canvasiphone.html Short: http://delivr.com/11cj0 Blogpost : http://mobilegeo.wordpress.com/2009/11/04/ html5-canvas-for-mobile-apps/ Short url: http://delivr.com/11cic
HTML5 Canvas • Retrieve pixel data “the real potential for HTML5 Canvas is to get inside the image itself enabling us to extract information from it and use that information to create our own graphics on the map “ Anna Chapman: practitioner of steganography
HTML5 Canvas: Data Extraction • Data extraction getImageData var xy = getxy(e, newCanvas ) ; var imgd = c.getImageData(xy.x, xy.y, 1 ,1 ) ; var pix1 = imgd.data ; var i = 0 ; var red = pix1[i]; // red var green = pix1[i+1]; // green var blue = pix1[i+2]; // blue !!! Browser Security restricts getImageData() to same domain as code !!! Demo feature selection using HTML5 canvas http://delivr.com/11cis
HTML5 Elevation Demo 1 Blog post: http://mobilegeo.wordpress.com/2010/03/01/integrating-openlayers-and-html5-canvas/ http://delivr.com/11cir
HTML5 Elevation Demo 2 Elevation demo: drawing a line on a map using HTML5 Canvas. At each point on the line, the height is extracted from the base terrain layer (previous slide) and plotted on the bar chart
HTML5 Canvas: Other data extraction use cases • Feature selection: highlight features (parking lots) on map. • Reduced Map Legend: Only shows symbols in view. • Speech Summary: detect features and summarize. • Accessible Maps? • Pro: Can all be done offline and works for raster maps as well as vector maps • Con: Mobile processors too slow for standard techniques such as Sobel and Colour Histogram. • Active research area for Edina.
HTML5 Local Storage • aka HTML5 Database • Provides SQL-lite database in browser. Can be used by applications to cache data. http://delivr.com/11clh http://unlock.edina.ac.uk/mobile.html
Augmented Reality “enhancing the user’s perception and interaction with the real environment by superimposing the real world with virtual information that appear to coexist in the same space as the real world.” * Priestnall, G. (2009) 'Landscape Visualization in Fieldwork', Journal of Geography in Higher Education, *F. Liarokapis, I. Greatbatch, D. Mountain, A. Gunesh, V. Brujic-Okretic, and J. Raper, "Mobile augmented reality techniques for geovisualisation,“ in Ninth International Conference on Information Visualisation (IV'05). IEEE, 2005, pp. 745-751. [Online]. Available: http://dx.doi.org/10.1109/IV.2005.79
AR – the virtual limb • Chris Kray, U. Newcastle, Augmented Tabletop: Visual markers displayed on screen used for performing collaborative tasks. • Could be used to share fieldtrip notes on map. [47] Kray C, Rohs M, Hook J, Kratz SGroup Coordination and Negotiation through Spatial Proximity Regions around Mobile Devices on Augmented Tabletops3rd IEEE Workshop on Tabletops and Interactive Surfaces (IEEE Tabletop 2008), Amsterdam, the Netherlands, October 1-3, 2008
Ubiquitous AR • New generation of “AR browsers” for iPhone, Android etc. (Layar, Wikitude) • Building Anatomy App Chris Lowry 3d model Superimpose on building facade View in Layar browser at 29m
Ubiquitous AR - issues • GPS accuracy – 3d image recognition • Simplifying 3d models • Lack of standards ( but innovation perhaps more important at the moment?) • Publishing platform?
Layar: create a Layar http://publishing.layar.com/publishing/layers/
Layar test: getPointOfInterest http://publishing.layar.com/publishing/test/iwmw2010demo1
Layar testing: POI search failed Probably a JSON format error
Check JSON with JSONLint http://www.jsonlint.com/
Layar: Points of Interest JSON { "hotspots": [ { "distance": 100, "attribution": "EDINA POI provider", "title": "Halifax Buildings, location = 53.371424, -1.505796", "lon": -1505796, "imageURL": "http://dlib-rainbow.ucs.ed.ac.uk/layar/img/halifax.jpg", "line2": "University of Sheffield", "line3": "Endcliffe Village", "actions": [ {"uri": "http://www.shef.ac.uk/accommodation/prospective/endcliffe", "label": "Open website" } ], "lat": 53371424, "type": 1, "id": "halifax" } ], "layer": "iwmw2010demo1", "errorString": "ok", "morePages": false, "errorCode": 0, "nextPageKey": null }
Points of Interest – go find ‘em! Endcliffe Vale Flats Longitude -1.508054 Latitude 53.371387 Froggatt Longitude -1.508688 Latitude 53.371907 The Edge Longitude -1.507504 Latitude 53.372711 Jonus Court Longitude -1.506040 Latitude 53.371751 Jonus court
Contrasting approaches to App Development Web App Native 3 4 2 Speed AR Basic location [1] Speech control No 3rd party API Easy deployment / publishing Data cache Quality assurance Open Standards Full access to sensors [3] Touch control Developer happiness 1 5 6 7 Hybrid