Programming and Design Patterns for the ArcGIS Mobile...
Transcript of Programming and Design Patterns for the ArcGIS Mobile...
Programming and Design Patterns for theProgramming and Design Patterns for theArcGIS Mobile SDKArcGIS Mobile SDK
Best PracticesBest PracticesJay Chen and Mike ShawJay Chen and Mike Shaw
Developer Summit 2008Developer Summit 2008 11
AgendaAgenda
•• OverviewOverview–– Positioning ArcGIS MobilePositioning ArcGIS Mobile–– Mobile ArchitectureMobile Architecture–– ArcGIS Mobile WorkflowArcGIS Mobile Workflow
•• Best PracticesBest Practices–– General UI Design/Coding ConsiderationsGeneral UI Design/Coding Considerations–– Working with MapsWorking with Maps–– Working with GPSWorking with GPS–– Editing Map Data Editing Map Data –– Fusing Data Using Web ServicesFusing Data Using Web Services
•• WhatWhat’’s New About 9.3s New About 9.3
Developer Summit 2008Developer Summit 2008 22
ArcGIS Mobile PositioningArcGIS Mobile Positioning
Developer Summit 2008Developer Summit 2008 33
Developer Summit 2008Developer Summit 2008 44
ArcGIS Mobile SDK at 9.2ArcGIS Mobile SDK at 9.2
•• .NET .NET ““Mobile ADFMobile ADF”” ships with ArcGIS Server Advanced ships with ArcGIS Server Advanced Enterprise EditionEnterprise Edition
•• A Suite of .NET Components for developing custom serverA Suite of .NET Components for developing custom server--centric centric lightweight mobile applicationslightweight mobile applications
4Software Development Kit (SDK)Software Development Kit (SDK)
.NET.NET JavaJavaMobileMobile
ArcGISArcGISMobileMobileWebMapWebMap
ApplicationsApplicationsBusinessBusiness
ApplicationsApplications
EnterpriseEnterpriseWebWeb WebWeb
Integration Environment
ArcGIS Mobile SDK at 9.3ArcGIS Mobile SDK at 9.3
•• An ArcGIS Server solution for developing mobile An ArcGIS Server solution for developing mobile applicationsapplications
•• Synchronization of Geographic information to and Synchronization of Geographic information to and from the field from the field –– optimized for wireless networksoptimized for wireless networks
•• Display rich mobile maps and cache Geographic edits Display rich mobile maps and cache Geographic edits locally when working offlinelocally when working offline
•• Easy to use and standardized developer environment Easy to use and standardized developer environment -- .NET SDK.NET SDK
Mobile GISMobile GIS
ArcGIS Mobile ArchitectureArcGIS Mobile Architecture
Developer Summit 2008Developer Summit 2008 66
ArcGIS Mobile SDK : Features OverviewArcGIS Mobile SDK : Features Overview
•• Suite of .NET Mobile GIS componentsSuite of .NET Mobile GIS components
•• Support multiple connectivity scenariosSupport multiple connectivity scenarios
•• Full Support of Geodatabase Transaction ModelFull Support of Geodatabase Transaction Model
•• Leverage Visual Studio 2005/2008 WinForms Leverage Visual Studio 2005/2008 WinForms
•• Small footprint and high performanceSmall footprint and high performance
•• Comprehensive developer helpComprehensive developer help–– Visual Studio integrationVisual Studio integration
–– Walkthrough, SamplesWalkthrough, Samples
–– Online documentationOnline documentation
Developer Summit 2008Developer Summit 2008
ArcGIS Mobile SDK:ArcGIS Mobile SDK:Seamless Microsoft Visual Studio IntegrationSeamless Microsoft Visual Studio Integration
Developer Summit 2008Developer Summit 2008
Net
wor
k R
esou
rces
Net
wor
k R
esou
rces
Win FormsWin Forms
.Net Framework / Compact .Net Framework.Net Framework / Compact .Net Framework
Data SyncData SyncComponentsComponents
DeviceDeviceData StoreData Store
UI ControlsUI Controls
Data ComponentsData Components
GPS ComponentsGPS Components
Mic
roso
ft Vi
sual
Stu
dio
2005
/200
8M
icro
soft
Visu
al S
tudi
o 20
05/2
008
ArcGIS Mobile SDK: Core ComponentsArcGIS Mobile SDK: Core Components
Developer Summit 2008Developer Summit 2008
MobileServiceMobileService
MapMapMapActionMapAction
ArcGISArcGISServerServer
FeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerRasterRasterLayerLayer
FeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerAnnotationAnnotation
LayerLayer
FeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureLayerFeatureFeatureLayerLayer
URL
Mobile Mobile ServiceService
GeoData GeoData ServiceService Network Network
Analysis Analysis ServiceService
Geoprocessing Geoprocessing ServiceService
ArcGIS Mobile SDK: Target PlatformsArcGIS Mobile SDK: Target Platforms
•• Microsoft .NET/.NET Compact Framework 2.0Microsoft .NET/.NET Compact Framework 2.0•• Windows Mobile 5.0/6.0Windows Mobile 5.0/6.0
–– PocketPC/ProfessionalPocketPC/Professional–– SmartPhone/StandardSmartPhone/Standard
•• Windows Mobile for Pocket PC 2003, 2003 SEWindows Mobile for Pocket PC 2003, 2003 SE•• Windows CE 5.0Windows CE 5.0•• Windows XP/XP Tablet/VistaWindows XP/XP Tablet/Vista
Developer Summit 2008Developer Summit 2008
ArcGIS Mobile SDK: PrerequisitesArcGIS Mobile SDK: Prerequisites
•• Visual Studio 2005 Standard and up, or Visual Studio 2008 Visual Studio 2005 Standard and up, or Visual Studio 2008 Professional and upProfessional and up
•• C# or VB.NETC# or VB.NET
•• Familiarity withFamiliarity with•• .NET Framework 2.0/.NET Compact Framework 2.0 .NET Framework 2.0/.NET Compact Framework 2.0 •• ADO.Net conceptsADO.Net concepts
•• Windows Mobile 5.0/6.0 SDKs (Pocket PC/Smartphone)Windows Mobile 5.0/6.0 SDKs (Pocket PC/Smartphone)•• Active Sync 4.1 or higher installed on XP or WMDC on VistaActive Sync 4.1 or higher installed on XP or WMDC on Vista•• Access to mobile devices to test deploymentAccess to mobile devices to test deployment•• Access to GPS devicesAccess to GPS devices•• Familiarity with ArcGIS ServerFamiliarity with ArcGIS Server
Developer Summit 2008Developer Summit 2008
.NET Compact Framework considerations.NET Compact Framework considerations
•• ItIt’’s a subset of .Net Frameworks a subset of .Net Framework–– 30% of the classes/methods of the full .Net Framework30% of the classes/methods of the full .Net Framework–– 4 MB minimum footprint vs. 40 MB on full .Net Framework4 MB minimum footprint vs. 40 MB on full .Net Framework
•• Optimized for Smart DevicesOptimized for Smart Devices•• Not everything works the sameNot everything works the same•• Read the documentationRead the documentation
Developer Summit 2008Developer Summit 2008
ArcGIS Mobile WorkflowArcGIS Mobile Workflow
Developer Summit 2008Developer Summit 2008 1313
ArcGIS Mobile WorkflowArcGIS Mobile Workflow
•• Build Mobile GeodatabaseBuild Mobile Geodatabase–– Information and Transaction Model considerationsInformation and Transaction Model considerations
•• Author Mobile Map (*)Author Mobile Map (*)–– Design for environment and form factorDesign for environment and form factor
•• Publish Map ServicePublish Map Service–– With Mobile Data Access CapabilitiesWith Mobile Data Access Capabilities
•• Design Mobile Application (*)Design Mobile Application (*)–– For Form Factor and EnvironmentFor Form Factor and Environment
•• Build Data Deployment Packages (*)Build Data Deployment Packages (*)–– Operational and base map datasetOperational and base map dataset
•• Deploy Mobile Solution (*)Deploy Mobile Solution (*)–– Application and DataApplication and Data
•• Synchronize Mobile GIS solutionSynchronize Mobile GIS solution–– Consider bandwidth and battery lifeConsider bandwidth and battery life
Developer Summit 2008Developer Summit 2008 1414
ArcMapArcMap ArcCatalog ArcCatalog or Server or Server ManagerManager
URLURLWeb ServicesWeb Services
Mobile Client
ArcGIS ServerArcGIS Server
Mobile MapMobile MapDocumentDocument
GeoDatabaseGeoDatabase
ArcGIS Server 9.2 FinalArcGIS Server 9.2 Final 1515
Author Mobile MapAuthor Mobile Map
•• Mobile Map Design Considerations:Mobile Map Design Considerations:––Design for purposeDesign for purpose
•• Remove unnecessary layers of informationRemove unnecessary layers of information
•• Set scale dependency based on scales of work (walk, drive, etc)Set scale dependency based on scales of work (walk, drive, etc)
•• Render editable layers to define feature typesRender editable layers to define feature types
––Design for the environmentDesign for the environment•• Establish contrast, choose meaningful symbologyEstablish contrast, choose meaningful symbology
––Design for device form factorDesign for device form factor•• Set scale dependency based on device resolutionSet scale dependency based on device resolution
•• Set symbol width based upon device resolutionSet symbol width based upon device resolution
•• Determine Base Map Data vs. Operational DataDetermine Base Map Data vs. Operational Data–– Compress Base Map Data using Create Mobile Base Map GP ToolCompress Base Map Data using Create Mobile Base Map GP Tool–– Build Operational Mobile Cache using Generate Mobile Service CacBuild Operational Mobile Cache using Generate Mobile Service Cachehe
Developer Summit 2008Developer Summit 2008 1515
1280x10241280x1024BIGBIG
320x240 Small
Sunlightwashes
outColors
Design Mobile ApplicationDesign Mobile Application
•• Mobile SDK installed as part of ArcGISMobile SDK installed as part of ArcGISServerServer
•• Use Visual Studio 2005/2008:Use Visual Studio 2005/2008:–– Windows Mobile 5.0 for Pocket PCWindows Mobile 5.0 for Pocket PC–– Windows Mobile 6.0 ProfessionalWindows Mobile 6.0 Professional–– Pocket PC 2003Pocket PC 2003–– Windows Mobile 5.0 for SmartphoneWindows Mobile 5.0 for Smartphone–– Windows Mobile 6.0 StandardWindows Mobile 6.0 Standard–– Tablets and Notebooks (XP/Vista)Tablets and Notebooks (XP/Vista)
•• IDE IntegrationIDE Integration•• Build Simple and focused user Build Simple and focused user
interfacesinterfaces•• Develop for function and form factorDevelop for function and form factor
Developer Summit 2008Developer Summit 2008 1616
ArcGIS Server 9.2 FinalArcGIS Server 9.2 Final 1717
Build Data Deployment PackagesBuild Data Deployment Packages
•• New Mobile Toolset inside of Desktop New Mobile Toolset inside of Desktop ArcToolboxArcToolbox
–– Create Mobile Base Map ToolCreate Mobile Base Map Tool
•• Creates a Base Map Data Set to be Creates a Base Map Data Set to be provisioned on mobile devices as base map provisioned on mobile devices as base map layerslayers
•• Support large base map datasetsSupport large base map datasets
–– Generate Mobile Service Cache ToolGenerate Mobile Service Cache Tool
•• Creates a mobile service cache for all Creates a mobile service cache for all operational layersoperational layers
•• Uses published mobile web service as input Uses published mobile web service as input and extracts layersand extracts layers
Developer Summit 2008Developer Summit 2008 1717
Deploy Mobile SolutionDeploy Mobile Solution
•• Use Standard Deployment Use Standard Deployment TechnologyTechnology–– ActiveSync, Windows Mobile Device ActiveSync, Windows Mobile Device
CenterCenter
–– Microsoft SMSMicrosoft SMS
–– SOTI MobiControlSOTI MobiControl
•• Secure server and client dataSecure server and client data
Developer Summit 2008Developer Summit 2008 1818
Visual StudioVisual Studio
MobileMobileEXEEXE
GP ToolsGP Tools
DataDataDeploymentDeployment
PackagePackage
DeploymentDeployment
MobileMobileEXEEXE
DataData
ArcGIS ServerArcGIS Server
Synchronize Mobile GIS SolutionSynchronize Mobile GIS Solution
Application:Application:•• Takes responsibility for managing Takes responsibility for managing
the sync processthe sync process•• Pushes and pulls new and Pushes and pulls new and
updated featuresupdated features•• Leverages spatial and attribute Leverages spatial and attribute
queries to optimize feature pull queries to optimize feature pull from the Serverfrom the Server
Developer Summit 2008Developer Summit 2008 1919
Day to Day SyncDay to Day Sync
ArcGIS Server
Best PracticesBest Practices
MikeMike
Developer Summit 2008Developer Summit 2008 2020
General UI Design GuidelinesGeneral UI Design Guidelines
Developer Summit 2008Developer Summit 2008 2121
•• Mapping device screens to device formsMapping device screens to device forms•• Screen layout/orientation awarenessScreen layout/orientation awareness•• Closing formClosing form•• Form navigationForm navigation
•• Handling input appropriately to boost productivityHandling input appropriately to boost productivity•• TapsTaps•• SIPSIP•• Hardware key/keyboardHardware key/keyboard
••Menu vs. Tool considerationsMenu vs. Tool considerations
General Coding GuidelinesGeneral Coding Guidelines
Developer Summit 2008Developer Summit 2008 2222
••Multiple threaded environmentMultiple threaded environment••Use BeginInvoke to push arguments to the UIUse BeginInvoke to push arguments to the UI
••Dispose of objects that implement IDisposableDispose of objects that implement IDisposable••Wrap inside using blockWrap inside using block
••Use try Use try …… catch blocks where appropriatecatch blocks where appropriate
••Employ defensive coding practicesEmploy defensive coding practices
•• Optimizing performanceOptimizing performance••Understand garbage collector in .Net CFUnderstand garbage collector in .Net CF
Best Practices Best Practices –– Working With MapsWorking With Maps
Developer Summit 2008Developer Summit 2008 2323
Map and MobileServiceMap and MobileService
Developer Summit 2008Developer Summit 2008 2424
DisplayDisplayMapMap
•• Map component draws data from local cache managed by Map component draws data from local cache managed by MobileService (threaded drawing)MobileService (threaded drawing)
•• MobileService stores map data on deviceMobileService stores map data on device•• MobileService component synchronizes updates with serverMobileService component synchronizes updates with server•• Map component supports markup/graphics on DisplayMap component supports markup/graphics on Display•• Map component supports drawing of custom layersMap component supports drawing of custom layers•• Map rotation supportedMap rotation supported
MobileServiceMobileService LayersLayers
Base Map Base Map ManagementManagement
Synchronize TipsSynchronize Tips
•• Use Request_Completed event to monitor Use Request_Completed event to monitor synchronization requestssynchronization requests–– Succeed or failSucceed or fail–– Statistics for each requestStatistics for each request
•• Use the State and Notifications Broker API and be smart Use the State and Notifications Broker API and be smart about how connected you areabout how connected you are……Microsoft.WindowsMobile.StatusMicrosoft.WindowsMobile.Status
Developer Summit 2008Developer Summit 2008 2525
Best Practices Best Practices –– Working With MapsWorking With Maps
The Simple Demo (Jay)The Simple Demo (Jay)
Developer Summit 2008Developer Summit 2008 2626
Demo Summary: Working With MapsDemo Summary: Working With Maps
IDE IntegrationIDE Integration•• Toolbox components with design time propertiesToolbox components with design time properties•• MapAction components encapsulate core tools MapAction components encapsulate core tools –– write write
less code!less code!
MapsMaps•• Map data drawn from local map cacheMap data drawn from local map cache•• MobileService component manages synchronization MobileService component manages synchronization
with the serverwith the server•• Drawing is multiDrawing is multi--threaded, UI is responsive!threaded, UI is responsive!•• Use MapCache::Request_Completed event!Use MapCache::Request_Completed event!
Developer Summit 2008Developer Summit 2008 2727
Best Practices Best Practices –– Working With GPSWorking With GPS
Developer Summit 2008Developer Summit 2008 2828
GPS ComponentsGPS Components
•• NMEA GPS implementationNMEA GPS implementation•• Smart GPS Map displaySmart GPS Map display•• Interface with Serial and File GPSInterface with Serial and File GPS•• Fires events with GPS positions for use in your Fires events with GPS positions for use in your
custom toolscustom tools
Developer Summit 2008Developer Summit 2008
File GPS File GPS ConnectionConnection
MapMap
SerialPortSerialPortGPSGPS
ConnectionConnection
GpsDisplayGpsDisplay
NMEANMEA
Best Practices Best Practices –– Working With GPSWorking With GPS
GPS Made Easy Demo (Jay)GPS Made Easy Demo (Jay)
Developer Summit 2008Developer Summit 2008 3030
Demo Summary: GPSDemo Summary: GPS
•• GPS Display component does all the work!GPS Display component does all the work!
•• GPS Serial Port or File connection used with GPS GPS Serial Port or File connection used with GPS device or log filedevice or log file
•• GPSEventArgs provides rich content parsed from GPSEventArgs provides rich content parsed from NMEA sentencesNMEA sentences
Developer Summit 2008Developer Summit 2008 3131
Best Practices Best Practices –– Editing Map DataEditing Map Data
Developer Summit 2008Developer Summit 2008 3232
ADO.Net IntegrationADO.Net Integration
•• Leverage ADO for:Leverage ADO for:–– Spatial and Attribute QueriesSpatial and Attribute Queries
•• Queries are executed against local dataQueries are executed against local data•• Data loaded into: Data loaded into:
–– FeatureDataTable (ADO DataTable) *Forward and BackwardFeatureDataTable (ADO DataTable) *Forward and Backward–– FeatureDataReader (ADO IDataReader) *Forward only, fasterFeatureDataReader (ADO IDataReader) *Forward only, faster
•• Supports updatesSupports updatesDeveloper Summit 2008Developer Summit 2008
RasterRasterLayerLayer
FeatureFeatureDataReaderDataReader
FeatureFeatureDataTableDataTable
MobileServiceMobileService
FeatureFeatureLayerLayer
AnnotationAnnotationLayerLayer
Layer Layer CollectionCollection
ADO.NetADO.Net
MobileServiceMobileService
Editing FeaturesEditing Features
•• Edits can be performed regardless of connection statusEdits can be performed regardless of connection status
•• Geometry editsGeometry edits–– Sketch Map Action and ComponentsSketch Map Action and Components
•• Add/Delete/Insert/Move vertexAdd/Delete/Insert/Move vertex–– Points, lines and polygon supportedPoints, lines and polygon supported
•• Attributes editingAttributes editing–– ADO.Net componentsADO.Net components
•• SnappingSnapping–– Feature layers onlyFeature layers only Developer Summit 2008Developer Summit 2008
MapMap Sketch Map Sketch Map Actions (4)Actions (4) GeometryGeometry
Feature Feature LayerLayer
ADO.NetADO.Net
Best Practices Best Practices –– Editing Map DataEditing Map Data
Data Collection Demo (Mike)Data Collection Demo (Mike)
Developer Summit 2008Developer Summit 2008 3535
Demo Summary: ESRI ConstructionDemo Summary: ESRI Construction
•• Create your own geometries and store them as features Create your own geometries and store them as features in the cachein the cache–– SketchMapActionSketchMapAction componentcomponent
•• AddVertexSketchTool, DeleteVertexSketchTool, InsertVertexSketchTAddVertexSketchTool, DeleteVertexSketchTool, InsertVertexSketchTool, ool, MoveVertexSketchToolMoveVertexSketchTool
•• MapActionCompleted()MapActionCompleted()
•• Select features and update their attributesSelect features and update their attributes–– Modify feature geometryModify feature geometry–– Update feature attributesUpdate feature attributes–– SelectionMapActionSelectionMapAction componentcomponent
•• SelectionLayers()SelectionLayers()•• SelctionTypeSelctionType•• GeometricRelationshipGeometricRelationship•• MapActionCompleted()MapActionCompleted()
•• Synchronize Edits with the ServerSynchronize Edits with the Server
Developer Summit 2008Developer Summit 2008 3636
Best Practices Best Practices –– Fusing Data Using Fusing Data Using Web ServicesWeb Services
Developer Summit 2008Developer Summit 2008 3737
Custom LayersCustom Layers
•• Provide ability to fuse data into the mapProvide ability to fuse data into the map–– Data sources other than ArcGIS ServerData sources other than ArcGIS Server
•• Data does not reside inside the local cache.Data does not reside inside the local cache.•• Provides framework to read and draw your dataProvides framework to read and draw your data•• Examples:Examples:
–– Dynamic Data (Live traffic, GeoRSS, etc)Dynamic Data (Live traffic, GeoRSS, etc)–– Web Services Data (Virtual Earth basemap, ArcWebServices Web Services Data (Virtual Earth basemap, ArcWebServices
POI)POI)–– ArcGIS Server Web Services (Geoprocessing, Network, etc)ArcGIS Server Web Services (Geoprocessing, Network, etc)
Developer Summit 2008Developer Summit 2008 3838
Best Practices Best Practices –– Fusing Data Using Fusing Data Using Web ServicesWeb Services
Live Traffic DemoLive Traffic Demo
Developer Summit 2008Developer Summit 2008 3939
Demo Summary: LiveTrafficDemo Summary: LiveTraffic
•• Uses Webservice to request live traffic dataUses Webservice to request live traffic data
•• Employs Custom LayerEmploys Custom Layer–– Data Storage outside the cacheData Storage outside the cache–– OverOver--ride Draw()ride Draw()–– Add to Map.MapLayers()Add to Map.MapLayers()
•• User defined symbologyUser defined symbology
Developer Summit 2008Developer Summit 2008 4040
WhatWhat’’s New about 9.3s New about 9.3
Developer Summit 2008Developer Summit 2008 4141
•• Mobile Map ArchitectureMobile Map Architecture•• MapGraphicLayersMapGraphicLayers•• MapLabelClassesMapLabelClasses•• MapLayersMapLayers
•• Mobile Services Cache and DataSourcesMobile Services Cache and DataSources•• ArcGIS Desktop GP ToolsArcGIS Desktop GP Tools
•• Create Mobile Base Map ToolCreate Mobile Base Map Tool•• Generate Mobile Service Cache ToolGenerate Mobile Service Cache Tool
WhatWhat’’s New about 9.3 (cont)s New about 9.3 (cont)
Developer Summit 2008Developer Summit 2008 4242
•• Support for Large Base Map datasetsSupport for Large Base Map datasets•• SDC integration as custom MapLayerSDC integration as custom MapLayer
•• Improved Editing and Sketching APIImproved Editing and Sketching API•• Improved GPS APIImproved GPS API•• Improved Projection supportImproved Projection support
ArcGIS Mobile ApplicationArcGIS Mobile Application
•• TaskTask--driven user experiencedriven user experience•• Configurable using Server Configurable using Server
ManagerManager•• Targets:Targets:
–– Simple GIS Feature EditingSimple GIS Feature Editing–– Map ViewingMap Viewing
•• Target Platforms:Target Platforms:–– Windows Mobile 5 Pocket PCWindows Mobile 5 Pocket PC–– Windows Mobile 6 ProfessionalWindows Mobile 6 Professional
ArcGIS Server ManagerArcGIS Server Manager
•• Create and manage Create and manage mobile web servicesmobile web services
•• Create and manageCreate and managemobile projectsmobile projects
•• Deploy mobile projectsDeploy mobile projectsand applications to devicesand applications to devices
Q&AQ&A
Developer Summit 2008Developer Summit 2008 4545
Further questions?Further questions?
•• ESRI ShowcaseESRI Showcase–– Mobile GIS IslandMobile GIS Island
•• Implementing ArcGIS Mobile Applications for the Implementing ArcGIS Mobile Applications for the EnterpriseEnterprise–– When: When: Thursday, March 20, 2008, 8:30amThursday, March 20, 2008, 8:30am--9:45am9:45am–– Where: Where: Catalina/Madera (Wyndham Hotel)Catalina/Madera (Wyndham Hotel)
Developer Summit 2008Developer Summit 2008 4646
Additional ResourcesAdditional Resources
•• ESRI Resource CenterESRI Resource Center–– http://resources.esri.com/http://resources.esri.com/
•• ESRI Developers Network (EDN) websiteESRI Developers Network (EDN) website–– http://edn.esri.comhttp://edn.esri.com
• ESRI Support Center–– http://support.esri.com/http://support.esri.com/
Developer Summit 2008Developer Summit 2008 4747