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
Runtime platforms .NET Desktop Mobile Embedded OS X Desktop Client Windows Store QT .NET iOS JavaSE Mobile Android Embedded Windows Mobile Windows Phone
ArcGIS Runtime SDK for iOS & OS X Build native applications using Objective-C & Swift OS X (Mountain Lion, Mavericks, Yosemite) iOS (6.x, 7.x, 8.x)
Before you begin… Mac Xcode 5.x or 6.x 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
SDK Resources developers.arcgis.com
Displaying map content Common Workflows
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 Construct & Connect ArcGIS On Premise Online URL to web service Add to mapview //Construct layer let tiledLayer = AGSTiledMapServiceLayer(URL: serviceUrl) //Add to map view self.mapView.addMapLayer(tiledLayer, withName:"World Street Map")
Web Maps Author on ArcGIS Online or on-premise ArcGIS Portal AGSWebMap JSON Web Maps Author on ArcGIS Online or on-premise ArcGIS Portal Predefined list of layers Initial map configuration Extent, scale range, symbology etc AGSWebMap Creates appropriate layer objects when opened into mapview //Create webmap self.webmap = AGSWebMap(itemId: "b31153c71c6c429a8b24c1751a50d3ad", credential:nil) //Open into mapview self.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
Demo Add a map to an app
Types of location apps GasBuddy Reminders Map centric No map
Types of location apps Redfin Yelp Map as context Map centric No map
Companion apps, working together For various form-factors
Searching for content Common Workflows
Searching for Content Search for Places Search for Places Search for Features ArcGIS Online Portal Search Portal /
Searching ArcGIS Org or Portal Server Online Content and Services Portal ArcGIS Org Searching ArcGIS Org or Portal Webmap Feature Layer Tile Layer Map Image Layer Create portal Searching for content
Searching ArcGIS Org or Portal Set delegate Delegation ? Adopt protocol Searching for content
Delegate acts on behalf of Delegating Object Delegation Delegate acts on behalf of Delegating Object Portal Eg. Portal Loaded Or Found Map etc. 1. Portal Event Portal Delegate (AnyClass) 2. User Interaction 4 Respond To Class 3. State Change Set a delegate object Adopt the protocol Implement methods of the protocol Searching for content
Searching ArcGIS Org or Portal Create Query Parameters Predefined Queries Custom Queries Searching for content
Searching ArcGIS Org or Portal Execute Queries Delegate Methods Query Results – Async Callback Searching for content
Portal Demo
Search for Places Search Portal / ArcGIS Online Searching for content
Search for Places - Geocode Service - Geocoding – Address to Locations http://<server>/ArcGIS/rest/services/Locators/ESRI_Geocode_USA/GeocodeServer - Geocoding – Address to Locations - Reverse Geocoding – Locations to Addresses Create locator Set delegate Searching for content
Search for Places Geocoding Set Parameters Execute Searching for content
Delegate Methods for Results Search for Places Delegate Methods for Results Handle Geocoding Results Delegation pattern Address Candidate objects Location Attributes Display in Map Searching your content
Geocoding Demo
Search for Places Search for Features Search Portal / ArcGIS Online Searching for content
In a single layer At a map location Search for Features In a single layer Query Task At a map location Identify Task Searching for content
Search for Features Query Task Single layer or table ArcGIS Map Service, Feature Service Vector Query for Features, ObjectIDs or just count Create a Query task Searching for content
Attribute Query Spatial Query Temporal Query Related Features Order By Search for Features Types of Queries - Attributes of the layer - where, outFields etc Attribute Query - Input geometry - Intersects, Within, Touches etc Spatial Query Statistics - Count, Std Dev etc - Group By Temporal Query - Input time extent Order By - Attributes - Asc or Desc Related Features - Relationship query Searching for content
Search for Features My favorite Query Searching for content
Search for Features My actual Query Searching for content
Search for Features Identify Task Multiple layers ArcGIS Map Service Create Identify Task Searching for content
Identify Task Parameters Search for Features Identify Task Parameters layerIDs geometry spatialReference layerOption returnGeometry mapEnvelope size tolerance Execute Identify Task Searching for content
Graphic In-memory object Features from - Feature service - Task results AGSGraphic - Geometry - Attributes - Symbol Searching your content
Query Task Demo
Predefined/Custom queries Search for Places Search for Features ArcGIS Online Portal Search Portal / Find featured maps Find Items/Groups Predefined/Custom queries Geocoding Query Task Identify Task Graphic Searching for content
Performing Analysis Common Workflows
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 ArcGIS Online Spatial Analysis service 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 let engine = AGSGeometryEngine.defaultGeometryEngine() Boolean crosses = engine.crosses(geometry:g1 crossesGeometry:g2)
Recap: Task Pattern Construct & Connect. Assign a delegate ArcGIS Online On Premise Construct & Connect. URL to web service Assign a delegate Set up input parameters. Invoke. Process results in the delegate.
Demo Analysis Samples
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
Editing geographic data Common Workflows
Editing Feature Layer Feature Layer in webmap What layer is required for Editing? Portal Developers Site ArcGIS Online/Org ArcGIS Server What are possible Feature Layer sources? Related Records Time Aware Non-Spatial Tables Spatial Features What types of features can be edited? Online Offline What are available Editing modes?
Sketch Layer Create, Edit Geometries Interactive No Code almost! Geometry used for Feature Layer Editing
Sketch Layer 1. Create a sketch layer 2. Assign it a mutable geometry How 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 Programmatic Sketching Undo Redo Notifications
Popups Display Feature Information Edit Attributes & Attachments Edit Geometry through Sketch Layer
AGSPopupsContainerViewController Web Map Feature Layer Configure Popups in webmap Create Popup from a feature Fetch Popups Get list of popups Popups Container AGSPopupsContainerViewController
Customize Popups Delegate Methods Start Edit Finish Edit Done View Cancel Delete and much more… Attributes Tool Bar Buttons Presentation
Editing Popups handle all this! Editor Tracking - User & Timestamp of Create/Update Ownership Based Access Control - Limit editing depending on user Popups handle all this! Capabilities - Limit editing for all users Data Validation - Non null, Coded and Range Values etc
Editing Apply Edits To Server Batch Updates Attachment Manager - Coarse grained methods
Editing Demo
Offline Capabilities Common Workflows
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 same Construct & Connect Path to local data 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 Author Map View Query Analyze Edit Synchronize Download
Offline Analysis Find addresses Get directions AGSLocator using Locator files Get directions AGSRouteTask using Network dataset Task pattern remains the same Construct & Connect. Path to local data Assign a delegate Set up input parameters. Invoke. Process results. Network Dataset Locator
Demo Offline Capabilities Developing Offline Apps with the Runtime SDKs – Thu, 8:30 AM, Room 33 A
Security Common Workflows
App Security Services Security ArcGIS Local Data Security
How can I protect my App? Use device’s Touch ID App Security Two Models 1. Local Authentication 2. Integration With Keychain
Do the right people have access to services? Services Security Do the right people have access to services? Authenticate Users Token Based Windows based Ciient Certificate Based Oauth
Do people have right access to services? Services Security Do people have right access to services? Authorize Users Ownership Based Access Control Capabilities Set up at Server/Portal Capabilities: Create,Query
Am I connecting to the right server in a secure way? 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
How can I protect the data in my device? Local Data Security How can I protect the data in my device? iOS provides Data Protection Default Protected Until First User Authentication - After first unlock since reboot Complete - Available only when unlocked Protected Unless Open - When unlocked - When file is already open No Protection - Always available
Local Data Security
App Services Local Data Security Summary Touch ID App Authentication Authorization SSL Services Data Protection Local Data
Runtime Licensing
License levels and functionality Available functionality Developer (development and testing only) All functionality (watermarks and debug messages will be generated) Basic Connected - all functionality Offline - 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 2 1 //Set client ID AGSRuntimeEnvironment. setClientID("DuxuhOEH9dAC4JCY”, error:nil)
How to license your app at the standard level You have 2 options: Use an organization account (ArcGIS Online or Portal for ArcGIS) Requires users of your app to log in with their account Use a license string obtained from Customer Service or your international distributor License burnt into the app //Set license code AGSRuntimeEnvironment.license().setLicenseCode(”<code>”)
Recap Common functionality & patterns Displaying map content Searching for content Performing analysis Editing geographic data Offline capabilities Security
Thank you Please fill out the survey