Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many...

30
Developing with the ArcGIS API for JavaScript and HTML5

Transcript of Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many...

Page 1: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Developing with the

ArcGIS API for JavaScript

and HTML5

Page 2: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Agenda

This seminar is designed to help you understand:

1) Getting started with the ArcGIS API for JavaScript

2) Writing your first JavaScript application

3) Enhancing your applications with HTML5 and Modern Dojo/AMD

Page 3: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Getting started with the

ArcGIS API for JavaScript

Page 4: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

ArcGIS API for JavaScript

• Web browser based API

• REST

• Many advantages

• Browser support

• Mobile devices

• Hosted at Esri

• Active development

http://www.esriurl.com/js

Page 5: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Dojo Toolkit

• ArcGIS API for JavaScript is built on top of the Dojo Toolkit

• Automates common JavaScript tasks and workflows

• Delivers mobile app layouts

• Provide common UI components

• Works with other frameworks

http://www.dojotoolkit.org

Page 6: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Resources

API Reference Samples

Sandbox

Page 7: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

The Basics

• The foundation of a Web mapping application

• Create a simple HTML document

• Reference the ArcGIS API for JavaScript

• Load modules

• Ensure the DOM is available

• Create the map

• Define the page content

• Style the page

W O

R K

F L

O W

Page 8: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Building from the foundation

• Add map elements

• Incorporate data layers

• Use feature layers for display and querying

• Map with dynamic requests

• Create an editing application

• Work with tasks and widgets

Page 9: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

• Getting started with the JavaScript API

Demonstration I

Page 10: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Review and Questions

• Getting started with the JavaScript API

Page 11: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Building JavaScript

Applications

Page 12: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Integrate with ArcGIS Online

• Utilize ArcGIS Online services

• Adding basemaps

• Geocoding addresses

• Adding hosted feature services

• Publish and share customized templates

• ArcGIS Online users can build applications

• Enable configuration settings

Page 13: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

ArcGIS Online templates

• Many pre-configured templates built with JS API

• Common layouts and functionality

• Downloadable

• Ready-to-use

• Configurable

• Customizable

Page 14: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Using templates

• Share web apps to preview and download

Page 15: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Configuring templates

• Review and edit template configuration

Page 16: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

• Building from the foundations – starting from an ArcGIS Online application template.

Demonstration II

Page 17: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Review and Questions

• Building from the foundations – starting from an ArcGIS Online application template.

Page 18: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Enhancing ArcGIS API for

JavaScript applications

Page 19: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Cross domain applications

• Native CORS (Cross-origin resource sharing)

• Server-side Proxy - referenced by JavaScript API

CORS-Enabled

Web Browser Remote Server

Access-Control-Allow-Origin: *

Web Browser

(no CORS)

Remote

Server Web Server

Proxy.ashx

esri.config.defaults.io.corsEnabledServers

esri.addProxyRule(rule)

or

esri.config.defaults.io.proxyUrl

Page 20: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Widgets

• Specialized widgets created by Esri for the JS API

• Map surround elements

Legend

• Application functions

InfoWindow

Geocoder

Directions

• Editing tools

Template picker

Overview Map

Print

Basemap Gallery

Attribute editing

Page 21: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Tasks

• Many out-of the box API modules for performing common tasks

Identify

Print

Locator

Route

Many more…

Query

Geoprocessing

GeometryService

ClosestFacility

Page 22: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

HTML5

• Targeted use of key Web browser capabilities to improve the user experience

• Geolocation API

• Web storage

• Drag and drop

• Web workers

• Web sockets

• Application cache (offline apps)

• Video playback

• Canvas

• HTML5 CORS

• Browser History

Page 23: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

CSS3

• Advanced styling with CSS3

• Responsive screen size based design

• Rounded corners

• Drop shadows

• Web fonts

• Multi-column text layout

• Animation and transitions with events

Page 24: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Browser Compatibility

• Leverage existing tools and resources to workaround/detect HTML5/CSS3 feature support

• html5shim

• Modernizr.com

• css3generator.com

• caniuse.com

• Don't code from scratch - leverage APIs/Libraries:

• Dojo/Dojox (included with the ArcGIS API for JS)

• jQuery

• Ext.JS … many more.

Page 25: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

AMD and Modern Dojo

• Asynchronous Module Definition

• dojo.require('app.Module') …

replaced by

require(["app/Module"],function(Module){ … })

• Modern Dojo

• Replaces many common dojo.* methods

• dojo.connect() replaced by dojo.on()

• Legacy methods continue to be supported

• Some API modules, and documentation/samples still in transition

Page 26: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

• HTML5/CSS3 and Modern Dojo/AMD

Demonstration III

Page 27: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Review

• HTML5/CSS3 and Modern Dojo/AMD

Page 28: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

• In this Web Seminar you learned about...

1) Getting started with the ArcGIS API for JavaScript

2) Writing your first JavaScript application

3) Enhancing your applications with HTML5 and Modern Dojo/AMD

Summary

Page 29: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Resources

• Finding developer resources

• http://developers.arcgis.com/en/javascript

• http://esri.github.com

• http://gis.stackexchange.com

• http://dojotoolkit.org

• Learning JavaScript and HTML5

• http://eloquentjavascript.net

• http://diveintohtml5.info

• http://yuiblog.com/crockford

Page 30: Developing with the ArcGIS API for JavaScript and HTML5 · ArcGIS Online templates •Many pre-configured templates built with JS API •Common layouts and functionality •Downloadable

Resources

• Related Training Courses

• Building Web Applications Using the ArcGIS API for JavaScript

• Upcoming Web Seminars & Events

• Implementing the ArcGIS Workflow Manager - Aug. 22

• Publishing Story Maps with ArcGIS - Sept. 26

• Data Quality Control Using ArcGIS Data Reviewer - Oct. 24

twitter.com/EsriCanada facebook.com/EsriCanada