Upload
others
View
23
Download
0
Embed Size (px)
Citation preview
ArcGIS Runtime SDKs:
Building a Routing ApplicationFrank Kish
Konstantin Kutsner
Overview
• What goes into a routing application
• Data connected \ disconnected
• Demo creating mmpk
• API
• Demo code
• Other Resources & Road Ahead
Slides, code, and data
Slides at:
http://proceedings.esri.com
Shared Box folder
https://goo.gl/r1vITx
This slide is repeated at the end this presentation
What makes up a routing application?
• Map
- visualization
- service\mobile map package
• Search
- given address get the x,y
- given a x,y get the address
- LocatorTask
• Routing
- find path from A to B to C
- find best path A, B and C
- RouteTask
ArcGIS Runtime SDK v100.x License Model
Standard
• License Key
• All capabilities of Basic
• Access to additional data
• Raster layers
• Raster elevation sources
• Local Server
• Map services
• Feature services
• Edit file geodatabases
• GP services
• Subset of ArcGIS Desktop
basic tools
Advanced
• License Key
• All capabilities of Standard
• Local Server
• Feature services
• Edit enterprise geodatabases
• GP services
• Subset of ArcGIS Desktop
standard and advanced
tools
Basic
• Named User – Level 2
• License Key
• All capabilities of Lite
• Simple feature editing
• Add, update, delete content on
portals
• Use of ArcGIS Online analysis
services
Lite
• Named User – Level 1
• License Key
• View maps, scenes, layers, packages
from the ArcGIS Platform
• Routing
• Place finding
Analysis Extension
• License Key
• Local Server GP tools
• Analysis
• 3D Analyst
• Spatial Analyst
• Network Analyst
Data - Users always\mostly connected?
• ArcGIS.com
- Mapping services
- World geocoding service
- World routing service
• Server\Portal
- Your own … mapping services
… geocoding services
… routing services
Data - Users always\frequently disconnected?
• Data on the device
• Mobile Map Package (.mmpk)
• ArcGIS Pro’s ‘Create Mobile Map Package’
• Single file that can include:
- Map(s), Locator(s), Network dataset(s)
Hybrid
• Scenario 1
- Maps on device in mmpk
- ArcGIS.com for search and routing
• Scenario 2
- ArcGIS.com for maps
- Your own search and route services
Connected vs. Disconnected
• Very little difference programmatically
• Initially create the map or task
- e.g. Route Task
• Resources and workflows
Local data
Create Address Locator
• Example
- Single Field Style
- Source Data
- Search Field
- Enable suggestions
• Locator files on disk
• Include in package
Demo – MMPK
Mobile Map Package
• Operational and Basemap data from different geodatabases
• For routing purposes use a (slightly) larger area
- to help maintain network connectivity near edges
• All the data is projected to the map’s spatial reference
ArcGIS Runtime API\SDK
SDK’s
- Android
- iOS \ macOS
- Java
- .NET
- Qt
ArcGIS
Examples of Loading a Map
from MMPK
Loading a Map from MMPK
• .Net - C#
string mmpkPath = @"C:\Data\DS2017Demo.mmpk";
// load the mobile map packageMobileMapPackage mmpk = await MobileMapPackage.OpenAsync(mmpkPath);
// set the mapview's map to the first map in the packageMyMapView.Map = mmpk.Maps[0];
Loading a Map from MMPK
• Android - Java
Loading a Map from MMPK
• iOS - Swift
Routing - Introduction
Basic steps for Routing
• Instantiate route task
• Create routing parameters and set properties
• Solve to find route
RouteTask & RouteParameters
• Route Task
- Network dataset in mmpk
- Uri to service
• Route Parameters
- Holds input parameters for a solve operation
- SetStops, StartTime, FindBestSequence, PreserveFirst
Basic steps for Routing – C#
// #1 create route task from the first map's first networkRouteTask routeTask = await RouteTask.CreateAsync(MyMapView.Map.TransportationNetworks[0]);
// #2 get the default parametersRouteParameters routeParameters = await routeTask.CreateDefaultParametersAsync(); routeParameters.SetStops(stopsList);
// #3 solvevar routeResult = await routeTask.SolveRouteAsync(routeParameters);
Basic steps for Routing – Java
Demo – Using a MMPK and
RouteTask
Routing - Details
Travel Modes
• Collection of settings that define how a ‘vehicle’ is
allowed to move through the network
- Impedance (e.g. TravelTime)
- Restrictions (e.g. Oneway)
• Defined in a network dataset
• The collection of properties work together
Routing service
• Publishing route analysis layer
- sits on top of network dataset
- has more properties that can be set than on
network dataset
- start time
- reorder stops to find optimal route
ArcGIS Runtime Routing classes
• RouteTask
• RouteParameters
• RouteTaskInfo
• TravelMode
• Stops
• RouteResults
• Route
• DirectionManeuvers
RouteTaskInfo
• Properties of underlying dataset \ service
• Read only
• Used to:
- create a UI default or options
- correctly set route parameter values
- valid travel mode or cost attributes
Stop
• Takes a MapPoint
- Can be in different spatial ref from network … solve operation will project
• Properties:
- add costs, set time windows
• Stops from a table
- Online or local geodatabase
- Field values are mapped to individual stop properties
- based on field naming convention
- http://desktop.arcgis.com/en/arcmap/latest/extensions/network-analyst/route.htm
Solve & RouteResult
• RouteTask.SolveRouteAysnc(RouteParameters)
• Returns a RouteResult
- Messages – high level information about the solve
- “One or more stops is located on a soft-restricted element”
- Routes
Routes
• Total Distance, Travel Time, Total Time, etc
• Stops
- Located stops
- Copy of the inputs stops
- Snapped to network different X,Y
- Other properties populate (e.g. Location Status)
• Direction Maneuvers
Direction Maneuvers
• DirectionText
- ‘Go northeast on Stevenson St toward 5th St’
• Geometry
• ManeuverType
• ManeuverMessages
- More detailed breakdown of the directions
• DirectionEvents
- Crossing a state or time zone boundary
Related Resources
Example Apps
• Open source applications built with the Runtime SDK
• Easy starting point for developing your own app
• Maps App – Android
- https://developers.arcgis.com/android/latest/guide/start-with-the-maps-app.htm
• Nearby Places – Android
- https://developers.arcgis.com/android/latest/guide/nearby.htm
• Indoor Routing - Xamarin
- https://github.com/Esri/indoor-routing-xamarin/tree/master/IndoorRouting
StreetMap Premium Custom Roads
• File Geodatabase, ArcGIS Pro project
- Add custom roads for routing
- Update network properties
• http://www.esri.com/data/streetmap
• Tutorial
- http://doc.arcgis.com/en/navigator/prepare-maps/add-assets-and-digitize-roads.htm
Navigator for ArcGIS
• App for iOS\Android
• Navigator custom URL scheme
- arcgis-navigator://?stop=43.65958,-70.25118
- https://github.com/Esri/navigator-integration
Road Ahead
Road Ahead
• Closest Facilities Task
• Service Area Task
- online in update 1
- local data in update 2
Road Ahead
• StreetMap Premium for Runtime
- MMPK’s
- Display, route and geocode
- network dataset and locators
- 5 regions
- North America
- Latin America
- Europe
- Middle East & Africa
- Asia Pacific
Please Take Our Survey!
Download the Esri Events app
and find your event
Select the session you
attended
Scroll down to the
“Feedback” section
Complete Answers,
add a Comment,
and Select “Submit”
Slides, code, and data
Slides at:
http://proceedings.esri.com
Shared Box folder
https://goo.gl/r1vITx