Developing iOS & Mac apps with ArcGIS Runtime SDK · 2015. 9. 3. · Search Portal / ArcGIS...

Preview:

Citation preview

Developing iOS & Mac appswith 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

Runtime platforms

QT

OS X

Windows Store

JavaSE

WindowsMobile

iOS

Android

Windows Phone

Mobile

Desktop

Embedded

.NET

DesktopClient

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)

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

developers.arcgis.com

SDK Resources

Common WorkflowsDisplaying map content

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

A Map is composed of Layers

• Operational data- Dynamic layers- Feature layers

• Temporary app data- Graphics layers

• Basemap- Tiled layer

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

Layer pattern

1. Construct & Connect• URL to web service

1. Add to mapview

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

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

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)

Displaying details about geographic features

• Popups make it easy to view- Attributes- Graphs, Charts- Attachments

- Picture- Video- PDF/MS-Office

attachments

Add a map to an app

Demo

Types of location appsGasBuddy

Map centric

Reminders

No map

Map centric No map

Yelp RedfinTypes of location apps

Map as context

Companion apps, working togetherFor various form-factors

Common WorkflowsSearching for content

Searching for Content

ArcGIS OnlinePortal

Search Portal /ArcGIS Online

Search for FeaturesSearch for PlacesSearch for Places

Searching ArcGIS Org or Portal

Searching for content

Webmap

Feature Layer

Tile Layer

Map Image Layer

Server Online Content and Services

Portal

ArcGIS Org

Create portal

Searching ArcGIS Org or Portal

Searching for content

Set delegate

Adopt protocol

Delegation

Delegation

Searching for content

Delegate acts on behalf of Delegating Object

4 Respond To ClassPortal Eg. Portal Loaded Or Found Map etc.

1. Portal EventPortal

Delegate(AnyClass)

2. User Interaction

- Set a delegate object

- Adopt the protocol

- Implement methods of the protocol

3. State Change

Searching ArcGIS Org or Portal

Searching for content

Custom Queries

Predefined Queries

Create Query Parameters

Searching ArcGIS Org or Portal

Searching for content

Execute Queries

Query Results – Async CallbackDelegateMethods

Portal Demo

Searching for content

Search for PlacesSearch Portal /ArcGIS Online

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

Search for Places

Searching for content

Set Parameters

Execute

Geocoding

Search for Places

Searching your content

Delegate Methods for Results

Handle Geocoding Results

- Delegation pattern

- Address Candidate objects- Location - Attributes

- Display in Map

Geocoding Demo

Searching for content

Search for FeaturesSearch for PlacesSearch Portal /ArcGIS Online

Search for Features

Searching for content

In a single layer

Query Task

At a map location

Identify Task

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

Search for Features

Searching for content

- Input geometry- Intersects, Within, Touches etcSpatial 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 etcAttribute Query

Types of Queries

Search for Features

Searching for content

My favorite Query

Search for Features

Searching for content

My actual Query

Search for Features

Searching for content

Identify Task

- Multiple layers

- ArcGIS Map Service

Create Identify Task

Search for Features

Searching for content

Identify Task Parameters

layerIDs

geometry

spatialReference

layerOption

returnGeometrymapEnvelopesize

tolerance

Execute Identify Task

Graphic

Searching your content

In-memory object

Features from

- Feature service

- Task results

AGSGraphic

- Geometry

- Attributes

- Symbol

Query Task Demo

Searching for content

Find featured mapsFind Items/Groups

Predefined/Custom queriesGeocoding

Query TaskIdentify Task

Graphic

ArcGIS OnlinePortal

Search Portal /ArcGIS Online

Search for FeaturesSearch for Places

Common WorkflowsPerforming Analysis

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

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

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

Recap: Task Pattern

1. Construct & Connect.- URL to web service

2. Assign a delegate3. Set up input parameters. Invoke.4. Process results in the delegate.

Analysis Samples

Demo

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

Common WorkflowsEditing geographic data

Editing

PortalDevelopers

SiteArcGIS

Online/OrgArcGIS Server

What are possible Feature Layer sources?

Online Offline

What are available Editing modes?

Feature LayerFeature Layer

in webmapWhat layer is required for Editing?

Related Records

Time AwareNon-Spatial Tables

Spatial Features

What types of features can be edited?

Sketch Layer

Create, Edit Geometries

Interactive

No Code almost!

Geometry used for Feature Layer Editing

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!

Sketch Layer

ProgrammaticSketchingUndo Redo Notifications

Popups

Display Feature Information

Edit Attributes & Attachments

Edit Geometry through Sketch Layer

Popups

Popups ContainerAGSPopupsContainerViewController

Web Map Feature Layer

Configure Popups in webmap

Fetch Popups

Create Popup from a feature

Get list of popups

Popups

Start EditFinish EditDone ViewCancelDelete

and much more…

Delegate Methods Customize

AttributesTool BarButtonsPresentation

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

Editing

Apply Edits To ServerBatch Updates

Attachment Manager- Coarse grained methods

Editing Demo

Common WorkflowsOffline Capabilities

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

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 same1. Construct & Connect

• Path to local data

2. Add to mapview

Tile package Geodatabase

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

Offline Analysis

• Find addresses- AGSLocator using Locator files

• Get directions- AGSRouteTask using Network dataset

• Task pattern remains the same1. Construct & Connect.

- Path to local data2. Assign a delegate3. Set up input parameters. Invoke.4. Process results.

Network Dataset Locator

Offline Capabilities

Demo

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

Common WorkflowsSecurity

Services Security

ArcGIS

Local Data SecurityApp Security

App Security

How can I protect my App?

Use device’s Touch ID

Two Models1. Local Authentication2. Integration With Keychain

Services Security

Do the right people have access to services?

Authenticate Users- Token Based

- Windows based

- Ciient Certificate Based

- Oauth

Services Security

Do people have right access to services?

Authorize Users

- Ownership Based Access Control

- Capabilities

- Set up at Server/Portal

Capabilities: Create,Query

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

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

Default

Local Data Security

Security Summary

AuthenticationAuthorization

SSL

Services

Touch ID

App

Data Protection

Local Data

Runtime Licensing

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

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)

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>”)

Recap

• Common functionality & patterns- Displaying map content- Searching for content- Performing analysis- Editing geographic data- Offline capabilities- Security

Please fill out the survey

Thank you

Recommended