An Overview of the ArcGIS API for Flex

Antony Jayaprakash Björn Svensson Agenda

• Introduction to the Adobe Flex framework • Introduction to the ArcGIS API for Flex • Building your first applications with Flex API

• We will answer questions at the end ArcGIS API for Flex

• Released in October 2008

• Well Adopted Solar Boston • Community support • ESRI solutions – Business Analyst Online – GeoPortal toolkit – StatestatStatestat,, BroadbandStatBroadbandStat,, etc.

District of North Vancouver Auckland Region Viewer ArcGIS A Complete Geographic Information System Use

Serve

ArcGIS Author Server

ArcGIS Desktop

. . . For Authoring, Serving & Using Geographic Knowledge ArcGIS Server Web API’ s

Flex

JavaScript

REST Silverlight

Java web ADF SOAP ArcGIS Server .Net Web ADF Adobe Flex Framework

• Flash is everywhere • Evolved from annoying banner ads to Enterprise applications • Preferred environment for RIA Adobe Flash Platform & ArcGIS

Rich Internet Applications Applications

ArcGIS API for Flex Client Framework Flex MXML ActionScript

Flash Player ActionScript Runtimes AIR MXML ActionScript JavaScript HTML, CSS

Operating Systems Mac, Windows, Linux, etc

Client JSON, SOAP, AMF, etc. HTTP, HTTPS, etc. Server

ArcGIS Server Why Flex Framework?

• Create applications that are, – Interactive, responsive – Easy to extend – Simple, yet powerful – CrossCross--platformplatform • Rich set of component s • IDE – Flash Builder – FlashDevelop – FDT – Int elliJ IDEA – Amethyst ((VisualVisual Studio plugin)plugin) • Stronggp developer community – http://www.adobe.com/devnet/flex ActionScript

• Based on ECMAScript language specification • Similar in syntax to Java, C# • Object Oriented (extends , implements) • Garbage Collection • Type safe • Introspection ActionScript Data Types

• Primitive types – Boolean, int, Null, Number, String, uint, void

• Complex types – Object, Array, Date, Error, function, RegExp, XML, XMLList MXML

• ActionScript in XML format • Mostly for UI Component / Layout • mxmlc compiler converts MXML to ActionScript • MXML attributes – property – style – event handlers

MXML to ActionScript

• MXML

• ActionScript var map : Map = new Map(); map.alpha = 0.5; var tiledLyr:ArcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(); tiledLyr.url = http://arcgisserver/mapservice/Parcels; Map.addLayer(tiledLyr); Life cycle of a Flex Application

Development

MXML ActionScript SWF

Deployment

Web Server

Browser

SWF System Requirements

• Required – Flex SDK 4.0 – Flash Player 10.0 – IDE (Flash Builder 4)

• Optional – Flash Catalyst – Adobe Creative Suite ArcGIS API for Flex Map

• Main component of the Flex API. • Mouse & keyboard navigation. • Scale bar, pan arrows, cross hair, rubberband can be styled. • Spatial reference & scale levels – determined by the first visible layer – or can be set explicitly Layers

• Tiled (cached) • Created dynamically: – Dynamic – Image Service – ArcIMS • ClientClient--sideside features: – Graphics Layer – Feature Layer • Custom layers ArcGIS Tiled Layer

• Used as base maps • tileInfo: Information on the tiling scheme • Multiple tiled layers in a map: – Same spatial reference required – Different tiling schemes allowed (scale levels, image format et)tc). – Layers only display at created scale levels Demo – First application

• Getting Started – Resource Center

• Our first application

• Flash Builder 4 ArcGIS Dynamic Layer

• Server generates images on the fly • Limit dynamic layers to frequently changing data • “disableClientCaching” prevents browser caching • Since 9.3.1 – optimized map services Demo – Service Directory

• Service Directory – tiled and dynamic services ImageService Layer

• ReadRead--onlyonly access to a mosaicked collection of images or a raster data set • New in 10: RasterFunction • Service Properties such as: – Service description – Service name – Description – Extent – Pixel sizes – Band counts ArcIMS Layer

• All versions of ArcIMS services are supported • Requirements: – crossdomain. file on the ArcIMS server or use a proxy page. – ArcIMS service needs to contain FEATURECOORDSYS and FILTERCOORDSYS id 's . Graphics Layer

• Graphics are geometry + attributes + symbols • Draw query results as graphics layers • Rich symbolization – Points, Lines, Polygons – Pictures – TextSymbol, InfoSymbol • Event driven model – Mouse, keyboard • Native flex properties • alpha, visible, .. • New in 2.0: clustering FeatureLayer

• New in 2.0 • Can be used for MapService • Extends GraphicsLayer – Selections – isEditable • Mode – Automatically caching upup--front,front, or as yypou pan and zoom Symbol

• Graphics are rendered using symbols

• Uses Flash graphics

• The symbol of a graphic is determined by (in order of preference): – The graphic’s defined symbol – The renderer defined in the layer – The symbol defined in the layer – The default symbol defined by our API Renderers

• SimpleRenderer • ClassBreaksRenderer – array of ClassBreakInfo • UniqueValueRenderer – array of UniqueValueInfo – New in 2.0: support for multiple attributes • New 2.0: TemporalRenderer – any renderer, plus aging and grouping by track Demo

• FeatureLayer – connecting to one MapService layer – instead of QQyuery + GGpraphicsLay er – class breaks renderer – FB: FeatureLayerBasedOnMapServerLayer Tasks

Classes and methods for common GIS tasks

• Query • Locate addresses • Search attributes • Identify features • Geoprocessing • Routing Query Task

• Returns a set of features • Set criteria with “where” • Filter returned fields • Set spatial relationship (e.g. “intersects”) • Applied on one layer at a time • Searches are case sensitive • New in 2.0: – reltdlated record s – Objectids – StandStand--alonealone tables Identify Task

• Executed in response to user interaction • Works on multiple layers in one request. • Can specify the layers to search • Cannot specify the fields to return Find Task

• Specify which fields in the layer(s) to search for. • Works on multiple layers in one request. • Case sensitive search by default, unless contains is true (which will be much slower) • Cannot specify the fields to return Summary: Identify vs. Query vs. Find

• Find – searches attributes based on a string literal (“searchText(“searchText”)”) – works on a service ((pspecific lay ers can be s pecified) • Identify – works on a service (specific layers can be specified) – can query a subset of(f layers (all, top, visible ) – is typically used for selecting a feature and returning its attributes • Query – works on one layer – has spatial relationship filtering capabilities (i .e . “intersects” ) – can filter based on geometry, WHERE clause or search text. Demo

• Query: – FeatureSet has Graphics. – Graphics have geometries, attributes and symbols. – Attributes in DataGrid • Query Related Records – objectIDs – relationships Locator Task

• Finds matching locations to an address • Finds matching address to a location • New in 2. 0: output spatial reference Useful Geoprocessing Task

• Input parameters determined by the GP service • Execute = synchronous • SubmitJob = asynchronous • Use a status callback function for checking the progress of a job Geometry Service

• A processing and algorithmic resource • Supports operations related to geometries • Project • Areas and lengths • Buffer • Label points • Lengths • RlRelati on • Simplify • New in 2. 0: Lots for editing Demo

• Chaining tasks: – Buffer with GeometryService – GGpeoprocessing Network Analyst

• Routing • Closest Facility • Service Area Demo – Network Analyst

• Closest Facility • Service Area Time

• TimeTime--awareaware layers • Time Slider • Temporal Renderer – observationRenderer – latestObservationRenderer – trackRenderer – observationAger Demo Time

• Temporal Renderer Editing

• FeatureService • Feature Templates • EditTool • Components – TemplatePicker – AttributeInspector – AttachmentInspector – Editor Demo Editing

• Service Directory • Samples – EditTool – AttributeInspector – Editor

– “Working with” sample Demo – Localization and DrawTips

• DrawTool with DrawTips New REST features in ArcGIS Server 10

• Editing (FeatureService) • TimeTime--awareaware layers • Stand-alone tables • Related records • Features with attachments • AMF (faster queries) • More GeometryService operations • Networ k Ana lyst: c losest fac ility and servi ce area • Layer Definitions for Identify & Find • Geocode service: outSR • wkt – spatial reference wellwell--knownknown text • Image Server: mosaicRulemosaicRule,, download raster, identify New features in ArcGIS API for Flex 2. 0

• Everything on last slide ☺ • FeatureLayer – Selections – Editable layers • Editing: – EditTool, Editor, TemplatePicker, AttributeInspector, AttachmentInspector • TimeSlider • Clustering • Localization Deployment Deployment • Project properties – Flash pl ayer versi on – Turn off “enable integration with browser navigation” – Use Runtime Shared Library (RSL)

• Release build – Default build is debug

• UseUfldUR output folder URL

• Cross domain access – crossdomain.xml – proxy page Looking ahead

• ArcGIS API for Flex 2.0 – Public Beta in April – CCpompatible with Flex 4 and Flash Builder 4 Summary

• Today we covered

– UUgnderstanding Adobe Flex framework – Introduction to ArcGIS API for Flex – Writing your first few applications

Still have questions? Other Flex Sessions …

• Meet the Team • Tue. 3/23, 6:00 – 7:30 p.m.

• Technical Sessions – Using and Extending the ArcGIS WebMapfor Flex • Tue. 3/23, 4:30pm -5:45am, Primrose B (PSCC) – Working with the ArcGIS API for Flex • Wed. 3/24, 10:30am10:30am--11:45am,11:45am, Primrose A (PSCC) • Thu. 3/25, 1:30pm1:30pm--2:45pm,2:45pm, Pasadena/Ventura/Sierra – Patterns and Best Practices for Building Applications with ArcGIS API for Flex • Thu. 3/24, 10:15am10:15am--11:30am,11:30am, Pasadena/Ventura/Sierra

Please complete the session survey! Want to Learn More? ESRI and Adobe Resources

• ArcGIS Resource Center – Samples, API Reference, Concepts, Community http://resources. esri. com/arcgisserver/apis/flex/

• Adobe – Flex developer Center http://www.adobe.com/devnet/flex/

– Flex 4 language reference http: //he lp.a do be.com/ en_US/Fl ex/4 .0/l angref/