83
Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Embed Size (px)

Citation preview

Page 1: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Developing iOS & Mac appswith ArcGIS Runtime SDK

Suganya Baskaran, Divesh Goyal

Page 2: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Topics

• Overview of Runtime

• Quick intro to SDK

• Common functionality & patterns- Displaying map content

- Searching for content

- Performing analysis

- Editing geographic data

- Offline capabilities

- Security

• Licensing

• Q/A

Page 3: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal
Page 4: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal
Page 5: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Runtime platforms

QT

OS XOS X

Windows Store

JavaSE

WindowsMobile

iOSiOS

AndroidAndroid

Windows Phone

Mobile

Desktop

Embedded

.NET

DesktopClient

Page 6: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

ArcGIS Runtime SDK for iOS & OS X

Build native applicationsusing Objective-C & Swift

OS X (Mountain Lion, Mavericks, Yosemite) iOS (6.x, 7.x, 8.x)

Page 7: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Before you begin…

• Mac- OSX 10.9, 10.10

(Mavericks, Yosemite)

• Xcode 5.x or 6.x- Apple’s iOS & OSX SDKs- iOS Simulator- Instruments

• ArcGIS Runtime SDK for iOS & OSX - Latest release : Version 10.2.4

Page 8: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

developers.arcgis.com

SDK Resources

Page 9: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Displaying map content

Page 10: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Displaying a Map

• UI Component : AGSMapView

- Responds to gestures- Touch

- Trackpad

- Mouse

- Keyboard

- In-built Magnifier & Callout

- Displays device location - Auto pan for location updates

Page 11: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

A Map is composed of Layers

• Operational data- Dynamic layers

- Feature layers

• Temporary app data- Graphics layers

• Basemap- Tiled layer

Page 12: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Sources of map data

• Tiled layers – subclasses of AGSTiledLayer- ArcGIS Map Services (Cached), OGC WMTS, Bing, OpenStreetMap

- Fetch pre-cached tiles from services and assemble on screen

- Extremely fast. Good for static data.

• Dynamic layers - subclasses of AGSDynamicLayer- ArcGIS Map Services, ArcGIS Image Services, OGC WMS

- Generate map images from service on-demand.

- Good for changing data, or customizing map display

• Feature layers – AGSFeatureLayer- ArcGIS Feature Services

- Download raw features and draw natively on screen

- Good for editing

Page 13: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Layer pattern

1. Construct & Connect• URL to web service

1. Add to mapview

//Construct layerlet tiledLayer = AGSTiledMapServiceLayer(URL: serviceUrl)//Construct layerlet tiledLayer = AGSTiledMapServiceLayer(URL: serviceUrl)

//Add to map viewself.mapView.addMapLayer(tiledLayer, withName:"World Street Map")//Add to map viewself.mapView.addMapLayer(tiledLayer, withName:"World Street Map")

Page 14: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Web Maps

• Author on ArcGIS Online oron-premise ArcGIS Portal- Predefined list of layers

- Initial map configuration- Extent, scale range, symbology etc

• AGSWebMap- Creates appropriate layer objects when

opened into mapview

JSON

//Create webmapself.webmap = AGSWebMap(itemId: "b31153c71c6c429a8b24c1751a50d3ad", credential:nil)

//Open into mapviewself.webmap.openIntoMapView(self.mapView)

//Create webmapself.webmap = AGSWebMap(itemId: "b31153c71c6c429a8b24c1751a50d3ad", credential:nil)

//Open into mapviewself.webmap.openIntoMapView(self.mapView)

Page 15: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Displaying details about geographic features

•Popups make it easy to view- Attributes

- Graphs, Charts

- Attachments- Picture

- Video

- PDF/MS-Officeattachments

Page 16: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Add a map to an app

Demo

Page 17: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Types of location appsGasBuddy

Map centric

Reminders

No map

Page 18: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Map centric No map

Yelp Redfin

Types of location apps

Map as context

Page 19: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Companion apps, working togetherFor various form-factors

Page 20: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Searching for content

Page 21: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching for Content

ArcGIS OnlinePortal

Search Portal / ArcGIS Online

Page 22: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching ArcGIS Org or Portal

Searching for content

WebmapWebmap

Feature LayerFeature Layer

Tile LayerTile Layer

Map Image LayerMap Image Layer

Server Online Content and Services

Portal

ArcGIS Org

Create portal

Page 23: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching ArcGIS Org or Portal

Searching for content

Set delegate

Adopt protocol

Delegation

Page 24: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Delegation

Searching for content

Delegate acts on behalf of Delegating Object

4 Respond To ClassPortal Portal

Eg. Portal Loaded Or Found Map etc.

1. Portal Event

Portal Delegate(AnyClass)

Portal Delegate(AnyClass)

2. User Interaction

- Set a delegate object

- Adopt the protocol

- Implement methods of the protocol

3. State Change

Page 25: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching ArcGIS Org or Portal

Searching for content

Custom Queries

Predefined Queries

Create Query Parameters

Page 26: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching ArcGIS Org or Portal

Searching for content

Execute Queries

Query Results – Async CallbackDelegateMethods

Page 27: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Portal Demo

Page 28: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching for content

Search Portal / ArcGIS Online

Page 29: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Places

Searching for content

- Geocode Service- http://<server>/ArcGIS/rest/services/Locators/ESRI_Geocode_USA/

GeocodeServer

- Geocoding – Address to Locations

- Reverse Geocoding – Locations to Addresses

Set delegate

Create locator

Page 30: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Places

Searching for content

Set Parameters

Execute

Geocoding

Page 31: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Places

Searching your content

Delegate Methods for Results

Handle Geocoding Results

-Delegation pattern

-Address Candidate objects- Location - Attributes

-Display in Map

Page 32: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Geocoding Demo

Page 33: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching for content

Search Portal / ArcGIS Online

Page 34: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

In a single layerIn a single layer

Query Task

At a map locationAt a map location

Identify Task

Page 35: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

Query Task

- Single layer or table

- ArcGIS Map Service, Feature Service

- Vector

- Query for Features, ObjectIDs or just count

Create a Query task

Page 36: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

- Input geometry- Intersects, Within, Touches etc

Spatial Query

Temporal Query - Input time extent

Statistics- Count, Std Dev etc- Group By

Related Features - Relationship query

Order By- Attributes- Asc or Desc

- Attributes of the layer- where, outFields etc

Attribute QueryTypes of Queries

Page 37: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

My favorite Query

My favorite Query

Page 38: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

My actual Query

My actual Query

Page 39: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

Identify Task

- Multiple layers

- ArcGIS Map Service

Create Identify Task

Page 40: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Search for Features

Searching for content

Identify Task Parameters

layerIDs

geometry

spatialReference

layerOption

returnGeometrymapEnvelope

size

tolerance

Execute Identify Task

Page 41: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Graphic

Searching your content

In-memory object

Features from

- Feature service

- Task results

AGSGraphic

- Geometry

- Attributes

- Symbol

Page 42: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Query Task Demo

Page 43: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Searching for content

Find featured mapsFind Items/Groups

Predefined/Custom queries

Find featured mapsFind Items/Groups

Predefined/Custom queriesGeocodingGeocoding

Query TaskIdentify Task

Graphic

Query TaskIdentify Task

Graphic

ArcGIS OnlinePortal

Search Portal / ArcGIS Online

Page 44: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Performing Analysis

Page 45: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Analysis on transportation networks

• Plan routes - AGSRouteTask- Point to Point, or multi-point

- Optimize based on distance or travel time

- Reorder stops for best sequence

- Time windows, Barriers & Restrictions

• Compute service areas - AGSServiceAreaTask

• Find closest facilities – AGSClosestFacilityTask

• ArcGIS Online World Route service- 100+ Countries. Live & Historical Traffic data

- Requires subscription. Consumes credits

• On-premise Route services for custom data

Page 46: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Spatial Analysis

• AGSGeoprocessor- Invoke geoprocessing services

• ArcGIS Online Spatial Analysis service- Summarize Data (Aggregate points, etc)

- Analyze Patterns (Watershed, Viewshed,etc)

- Use Proxmity (Density, HotSpot, Interpolate, etc)

• On-premise Geoprocessing services- Custom geoprocessing tools & models

Page 47: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Geometric Operations

• AGSGeometryEngine- Native, high performance engine

- Relationship tests - Touches, Intersects, Within,

Contains, Overlaps, Crosses

- Set operations- Union, Difference, Intersect

- Topological operations- Cut, Clip, Simplify, Densify, Buffer, ConvexHull

- Measure areas and distance

- Project between spatial references

Page 48: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Recap: Task Pattern

1. Construct & Connect.- URL to web service

2. Assign a delegate

3. Set up input parameters. Invoke.

4. Process results in the delegate.

Page 49: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Analysis Samples

Demo

Page 50: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Reuse code between iOS & Mac

• M-V-C architecture enables code sharing- M : Model

- V : View

- C : Controller

• Model classes & business logic can be reused- Based on Apple’s Foundation framework, common to iOS & Mac

• View and View-Controller are platform specific- Based on Apple’s UIKit on iOS, AppKit on Mac

Page 51: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Editing geographic data

Page 52: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Editing

PortalDeveloper

s SiteArcGIS

Online/OrgArcGIS Server

What are possible Feature Layer sources?

Online Offline

What are available Editing modes?

Feature Layer

Feature Layer in webmap

What layer is required for Editing?

Related Records

Time Aware

Non-Spatial Tables

Spatial Features

What types of features can be edited?

Page 53: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Sketch Layer

Create, Edit Geometries

Interactive

No Code almost!

Geometry used for Feature Layer Editing

Page 54: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Sketch LayerHow does it Work?

1. Create a sketch layer

2. Assign it a mutable geometry

3. Set delegate to receive touch events

Secret Step 4: Reset touch delegate after Editing!

Page 55: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Sketch Layer

ProgrammaticSketchingUndo Redo Notifications

Page 56: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Popups

Display Feature Information

Edit Attributes & Attachments

Edit Geometry through Sketch Layer

Page 57: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Popups

Popups ContainerAGSPopupsContainerViewController

Popups ContainerAGSPopupsContainerViewController

Web MapWeb Map Feature LayerFeature Layer

Configure Popups in webmap

Configure Popups in webmap

Fetch PopupsFetch Popups

Create Popup from a feature

Create Popup from a feature

Get list of popupsGet list of popups

Page 58: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Popups

Start Edit

Finish Edit

Done View

Cancel

Delete

and much more…

Delegate Methods Customize

Attributes

Tool Bar

Buttons

Presentation

Page 59: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Editing

Editor Tracking- User & Timestamp of Create/Update

Capabilities - Limit editing for all users

Ownership Based Access Control- Limit editing depending on user

Popups handle all this!

Data Validation- Non null, Coded and Range Values etc

Page 60: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Editing

Apply Edits To Server

Batch Updates

Attachment Manager- Coarse grained methods

Page 61: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Editing Demo

Page 62: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Offline Capabilities

Page 63: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Patterns for generating offline content

•Desktop Pattern- Package data through ArcMap

- Side load onto device, or bundle in application

•Services Pattern- Extract data from services on-the-fly

- Tile package - AGSDownloadTileCacheTask- Geodatabase - AGSGDBSyncTask

Tile package Geodatabase

Network Dataset Locator

Page 64: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Offline Mapping

• View & Interact with maps- Display Tile package - AGSLocalTileLayer- Display Geodatabase - AGSFeatureTableLayer

- Query using SQL or spatial criteria

- Edit existing or create new features

• Layer pattern remains the same

1.Construct & Connect• Path to local data

2.Add to mapview

Tile package Geodatabase

Page 65: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Offline Editing

• Edits persisted in the geodatabase on the device

• Changes can be synchronized with the service- Upload only, Download only, or Bidirectional

AuthorMap

ViewQuery

AnalyzeEdit

Synchronize

Download

Page 66: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Offline Analysis

• Find addresses- AGSLocator using Locator files

• Get directions- AGSRouteTask using Network dataset

• Task pattern remains the same

1.Construct & Connect.- Path to local data

2.Assign a delegate

3.Set up input parameters. Invoke.

4.Process results.

Network Dataset Locator

Page 67: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Offline Capabilities

Demo

Developing Offline Apps with the Runtime SDKs – Thu, 8:30 AM, Room 33 A

Page 68: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Common Workflows

Security

Page 69: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Services Security

ArcGIS

Local Data SecurityApp Security

Page 70: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

App Security

How can I protect my App?

Use device’s Touch ID

Two Models

1. Local Authentication

2. Integration With Keychain

Page 71: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Services Security

Do the right people have access to services?

Authenticate Users

- Token Based

- Windows based

- Ciient Certificate Based

- Oauth

Page 72: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Services Security

Do people have right access to services?

Authorize Users

- Ownership Based Access Control

- Capabilities

- Set up at Server/Portal

Capabilities: Create,QueryCapabilities: Create,Query

Page 73: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Services Security

Am I connecting to the right server in a secure way?

Use SSL- Verifies Identify of Server

- Creates an encrypted link

- Set up at Server/Portal

- Use https

Page 74: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Local Data Security

How can I protect the data in my device?

iOS provides Data Protection

Protected Until First User Authentication - After first unlock since reboot

Complete- Available only when unlocked

No Protection- Always available

Protected Unless Open - When unlocked - When file is already open

DefaultDefault

Page 75: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Local Data Security

Page 76: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Security Summary

Authentication Authorization

SSL 

Services

Touch ID

App

Data Protection

Local Data

Page 77: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Runtime Licensing

Page 78: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

License levels and functionality

License Level Available functionality

Developer (development and testing only) All functionality (watermarks and debug messages will be generated)

Basic Connected - all functionalityOffline - map viewing only

Standard Connected and offline - all functionality, includes:•Local locators (geocoding)•Local routing•Local geodatabase editing•Local geodatabase sync operations

Page 79: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

How to license your app at the basic level

• http://developers.arcgis.com

• Under Application section, create a New Application (or select existing)

• Click on Runtime SDK Licensing

• Copy the Client ID and use it to set your clientID

1

2

//Set client IDAGSRuntimeEnvironment.setClientID("DuxuhOEH9dAC4JCY”, error:nil)

//Set client IDAGSRuntimeEnvironment.setClientID("DuxuhOEH9dAC4JCY”, error:nil)

Page 80: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

How to license your app at the standard level

• You have 2 options:

1. Use an organization account (ArcGIS Online or Portal for ArcGIS)- Requires users of your app to log in with their account

1. Use a license string obtained from Customer Service or your international distributor- License burnt into the app

//Set license codeAGSRuntimeEnvironment.license().setLicenseCode(”<code>”)//Set license codeAGSRuntimeEnvironment.license().setLicenseCode(”<code>”)

Page 81: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Recap

• Common functionality & patterns- Displaying map content

- Searching for content

- Performing analysis

- Editing geographic data

- Offline capabilities

- Security

Page 82: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal

Please fill out the survey

Thank you

Page 83: Developing iOS & Mac apps with ArcGIS Runtime SDK Suganya Baskaran, Divesh Goyal