building a mobile, cloud, checkin app in 75 minutes - zero to hero

61
[email protected] | @AL_Laframboise [email protected] | @ DMDevDude Esri Developer Network Building a Mobile, Cloud, Check-in App in 75 Minutes - Zero to Hero

Upload: oreillywhere20

Post on 21-May-2015

1.901 views

Category:

Technology


1 download

DESCRIPTION

Session on how to build a complete mobile-cloud solution using ArcGIS mobile APIs and an ArcGIS Online Subscription. How to monetize your solution too! By Allan Laframboise, Esri

TRANSCRIPT

Page 1: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

[email protected] | @AL_Laframboise

[email protected] | @ DMDevDude

Esri Developer Network

Building a Mobile, Cloud, Check-in App in 75 Minutes

- Zero to Hero

Page 2: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

www.esri.com/devmeetups

Dev Meet Ups

Page 3: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Esri = “ezri”

Page 4: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

GIS

Geospatial platform… solve location-based problems.

Page 5: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Modeling with layers…

Geospatial Sandwich

Page 6: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Basics

place street parcel

Features

Point Line Polygon

Page 7: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

The “arc”

Intelligent Feature

Direction

Start

End

Page 8: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

“Arc”GIS

Mobile

Desktop

Web Create

Store

Manage

Analyze

Visualize

Share

Cloud

Enterprise

Page 9: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

GIS apps are

Location-based apps

GIS

Location-based Systems

Page 10: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Location Intelligence

E311/Service Request

Campus Routing

Sky Harbor Airport

Quake Map

Page 11: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Social Intelligence

Page 12: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Geolocation

Page 13: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Power of Social

Page 14: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

GIS architecture - 101

Basemaps

Geo Services ArcGIS Server

GPS

Geodatabase

Social Media

ArcGIS Online

Mobile Web

Flex

Page 15: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

So you want to build an app…

Page 16: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

The idea

+

Page 17: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Pizza Finder!

Page 18: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Maps

Apps Value

Page 19: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

User Requirements

Find pizza restaurants

Within a certain “tolerance”

Around me, address or touch map

Route

Check-in

Page 20: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

the mock-up

Page 21: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

System Requirements

Multiple devices

No hardware

Single service provider

Page 22: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Business Requirements

Page 23: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Got a cloud-based, geospatial solution?

Bueller?

Page 24: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS Online Platform

Page 25: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

www.arcgis.com

Page 26: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS Online Subscription - your personal cloud.

Page 27: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Upload to the cloud

POI

Check In

Page 28: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Forgot to demo?

Page 29: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS APIs

Choosing your weapon

Page 30: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Mobile and Web

Apple iOS

Microsoft Windows

Phone 7

Google Android

Native or Web?

Page 31: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS for JavaScript

ArcGIS for iOS

ArcGIS for Windows Phone

ArcGIS for Android

ArcGIS for Windows Silverlight

ArcGIS for Flex

resources.arcgis.com

Page 32: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS Online Basemaps

Visualizing your world

Page 33: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Base layer options…

Page 34: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Projections and Spatial References

Page 35: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Where in the world am I?

-87.6,41.9

-9743828.3,5131825.1

Geographic - WGS 1984

Mercator

Page 36: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Basemap Service

dojo.require("esri.map"); map = new esri.Map("mapDiv", { wrapAround180: true, null }); map.SetSpatialReference({"wkid":102100}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL); map.addLayer(basemap);

var basemapURL = “http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer”;

Page 37: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

ArcGIS Online Services

Solving problems

Page 38: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Where am I?

Page 39: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Input Coordinates

function zoomToLocation(location) { var centerPoint = esri.geometry.geographicToWebMercator( new esri.geometry.Point(location.coords.longitude, location.coords.latitude)); var symbol = new esri.symbol.PictureMarkerSymbol( {"url":”images/BluePin1LargeB.png“,”width":28,"height":28} ); var graphic = new esri.Graphic(centerPoint, symbol); geolocationLayer.graphics.add(graphic); map.centerAndZoom(centerPoint, 16); }

navigator.geolocation.getCurrentPosition(zoomToLocation, this.geolocationError);

Page 40: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Geocode Service

var address = { "SingleLine": address }; locator.outSpatialReference = map.spatialReference; var params = {address: address, outFields: ["Loc_name"]} geocodeService.addressToLocations(params, geoCodeResults); Ext.each(candidates, function (candidate) { if (candidate.score > 80) { var geom = candidate.location; var graphic = new esri.Graphic(geom, symbol, null); geoCodeLayer.graphics.add(graphic); } });

var geocodeService = new esri.tasks.Locator("http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer");

Page 41: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Drive time tolerance?

Page 42: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Geoprocessing Service

var driveTimes = “1 2 3”; // minutes var featureSet = new esri.tasks.FeatureSet(); featureSet.features = features.push(geoCodeGraphic); var params = {"Location":featureSet,"Times":driveTimes }; geoProcessService.execute(params, driveTimeResults, null); function driveTimeResults(results,messages) { var features = results[0].value.features; for (var f = 0, fl = features.length; f < fl; f++) { var feature = features[f]; if (f == 0) // minute 1 feature.setSymbol(polySymbolRed); if (f ==1) // minute 2 … driveTimeLayer.add(feature); } ); }

var geoProcessService = new esri.tasks.Geoprocessor( "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons");

Page 43: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Find places of interest

Page 44: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Feature Service – “geo query”

var q = new esri.tasks.Query(); q.returnGeometry = true; q.outFields = ["NAME", "ADDRESS", "PHONE", "DESCRIPTION"]; q.geometry = driveTimeGeometry; q.spatialRelationship = esriSpatialRelIntersects q.where = "Cuisine = 'pizza'"; poiCloudFeatureService.execute(q, addPizzaLocations, null); function addPizzaLocations(features) { Ext.each(features , function(feature){ graphic = new esri.Graphic(feature.geometry, symbol, null); pizzaLayer.add(graphic); }); }

var poiCloudFeatureService = new QueryTask ("http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/BIG_POI/FeatureServer/0");

Page 45: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Select a place

Page 46: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Graphics Query

dojo.connect(pizzaLayer, "onClick", displayInfo); function displayInfo(args) { var pizzaLocation = args.graphic; var newView = Ext.create('PF.view.PizzaLocation', {

fullscreen:true, feature:pizzaLocation, title:pizzaLocation.attributes['Name'] }); this.defaultMapView.push(newView);

}

var pizzaLayer= map.layers["pizzaLayer"]; // stay local

Page 47: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Ok, take me there!

Page 48: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Route Service

var params = new esri.tasks.RouteParameters(); params.stops.features[0] = startLoc; params.stops.features[1] = endLoc; params.returnDirections = true; params.directionsLengthUnits = esri.Units.MILES; routeService.solve(params, function (solveResult) { var directions = solveResult.routeResults[0].directions; directionFeatures = directions.features; var routeGeom = directions.mergedGeometry; var startPt = routeGeom.getPoint(0,0); var lastPath = routeGeom.paths[routeGeom.paths.length - 1]; var endPt = routeGeom.getPoint(routeGeom.paths.length – 1, lastPath.length - 1); } function addGraphics(startPt, endPt, lastPath)…

var routeService = new esri.tasks.RouteTask ("http://tasks.arcgisonline.com/arcgis/rest/services/Network/USA/NAServer/Route");

Page 49: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Are we there yet?

Page 50: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Geometry Service - geofencing

var bufParams = new esri.tasks.BufferParameters(); bufParams.distances = [ 25 ]; bufParams.geometries = [ toPt ]; bufParams.outSpatialReference = new esri.SpatialReference({"wkid":102100}); geomService.buffer(bufParams, function (geometries) { var geoFence = geometries[0]; var symbol = self.checkinToleranceSymbol; var graphic = new esri.Graphic(geoFence, symbol); geoFenceGraphicLayer.add(graphic) }); … isPoint InFence = geoFence.contains(currentLocation); // local

Var geomService = new esri.tasks.GeometryService( "http://tasks.arcgisonline.com /ArcGIS/rest/services/Geometry/GeometryServer");

Page 51: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

check-in

Page 52: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Feature Service – update the cloud

// Invisible layers var distance = getDistance(routeGraphic); var duration = getDuration(checkInTime, checkOutTime); var userRating = getUserRating(duration, distance); routeGraphic.Attributes["POI_ID"] = poi.attribues[' POI_ID' ]; routeGraphic.Attributes["Name"] = poi.attributes[' NAME' ]; routeGraphic.Attributes["CheckIn"] = checkInTime; routeGraphic.Attributes["CheckOut"] = checkOutTime; routeGraphic.Attributes["Duration"] = duration; routeGraphic.Attributes["Distance"] = distance; routeGraphic.Attributes["Rating"] = userRating; checkInLayer.applyEdits([routeGraphic], null, null);

var checkInLayer = new FeatureLayer( "http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/PizzaCheckins/FeatureServer/1");

Page 53: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

edn1.esri.com/pizzafinder

Page 54: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero
Page 55: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Putting it all together

Monetizing your cloud

Page 56: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Sharing your cloud

Cloud Space

Webmaps

Gino’s

Tomato Head

sBarro

ArcGIS Online

Page 57: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Forgot again?

Page 58: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

A closer look with GIS

Demographics Location

Advertising

Spatial Patterns

Customers

Monetization

Stronger Business

Page 59: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero
Page 60: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

The “Ultimate” Geospatial Sandwich

That’s your mobile, cloud, check-in solution in 75 minutes!

Page 61: Building a mobile, cloud, checkin app in 75 minutes -  zero to hero

Questions?

http://edn1.esri.com/pizzafinder

(via Chrome, iPhone, iPad and Android)

[email protected] | @AL_Laframboise

[email protected] | @ DMDevDude