UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

© 2015 UNIGIS 1 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

Upon the completion of this presentation you should be able to:

• List the existing ArcGIS WebAPIs

• Customize your own web mapping application

ESRI web mapping API‘s for JavaScript, Flex and Silverlight will be introduced in this lesson.

© 2015 UNIGIS 2 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

What you‘ve learned earlier in the course makes it quite easy for you to understand . However, before going further, we’ll wrap-up quickly the ArcGIS Server Architecture in order to recall what is behind the scene.

In the graphic presented above we start from the right to the left: • GIS resource (data either file based or data stored in a geodatabase, maps, tools etc.) are prepared (designed and authored) for being published • GIS resources are then published in ArcGIS for Server either as a map service, geoprocessing service or any other available services options. Through these services, we are actually exposing our geographic resources over the internet for display, edit or use • Published geographic resources will be consumed by different client applications using different protocols: a. REST: URL b. SOAP: get access to data c. OGC: we are using OGC web services specifications to consume GIS resources in client APIs

Thus, spatial data are served as GIS services, wrapped-up into a protocol and in the end are used in client APIs. In this lesson, we’ll be discussing about Client API’s.

© 2015 UNIGIS 3 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

Why to use Web APIs? Because APIs let us focusing on rapid application development. For instance, if you want to add a map to your web application, you simply write: Map.addlayer (basemap), rather than manipulating in your code the REST APIs that is behind the scene. Web APIs provide a framework for integrating multiple services.

There are several ArcGIS Web APIs (http://resources.arcgis.com/content/web/web- apis) • JavaScript • • Abode Flex • HTML5

Existing Web APIs have a rich functionality. Their capabilities include: map, Query, editing, geometries, time-awareness, routing, extents, FeatureLayers, GraphicLayers, Symbols, Graphics, Geoprocessing etc.

© 2015 UNIGIS 4 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

It is important to know that ArcGIS APIs communicate with web services using REST, WMS and WMTS protocols.

© 2015 UNIGIS 5 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

Why JavaScript? It runs natively in all web browsers in comparison with Microsoft Silverlight or Abode Flex which requires plugins for enabling developed applications to run in web environments. The run time for script is in the browsers and thus no separate plug-in is required.

There are also many different JavaScript frameworks available: • EXTJS, • Dojo: Dojo is a robust JavaScript Toolkit with a strong community support. You can use Dojo in conjunction with other libraries as well. Dojo has a very robust graphics library (rich client side graphics), strong widgets systems. When you wrap it in your API and built a graphic-based application, it is really easy to develop it. For more information, please visit this site: Dojo and the ArcGIS API for JavaScript – dojotoolkit.org • jQuery • Sencha

There are also many development environments choices: Aptana, Visual Studio, Eclipse, Dreamweaver etc.

© 2015 UNIGIS 6 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

How to start developing a Microsoft Silverlight client applications? There are at least three possibilities: • Start from scratch • ESRI resource Center: a lot of codes available  • Viewer: ArcGIS Application Builder for Microsoft Silverlight: pre-done application, no programming is required

The easiest way to develop Microsoft Silverlight Client applications is to use ArcGIS Viewer for Microsoft Silverlight. This application is a configurable web mapping application that does not require any single programming code. It includes builder tool for customizing the look and feel of applications, customize tools and layout. To set up the Microsoft Silverlight environment you need: • Microsoft Silverlight tools • An development environment: e.g. Visual Studio • Runtime for browser: you need to install it in order to run a Microsoft Silverlight – based web application. ArcGIS Explorer Online is an example of Microsoft Silverlight Client application. To use it, you need to download the Microsoft Silverlight plug-in. Remember that, JavaScript does not require any plug-in for running n web browsers (it runs natively in all browsers).

© 2015 UNIGIS 7 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

ArcGIS API for Flex provides web programming frameworks to build web mapping using Abode Flex. It enables you to create apps to run with Abode Flash Player Plug- in. Abode Flash platform is what empowering ArcGIS API for Flex. Adobe Flex is based on several Abode Flash Technologies that make Flex Applications to run in browsers (see the technology stack above).

© 2015 UNIGIS 8 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

ArcGIS Viewer for Flex is a downloadable application that comes with a simple set of tools, or widgets that you can customize using an easy-to-use graphical interface. You do not have to write programming codes for customizing your application. You simply download the application, save it in your web server, import map services and adjust the layout appearance.

© 2015 UNIGIS 9 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

What is HTML 5? HMTL 5 is the combination of: HTML+CSS version 3+JavaScript The defining characteristics of HTML5 are: • New semantic tags: meaning of the information on the page rather than how the page looks • Improved form elements (mark up) • Additional APIs (FileAPI, Web Workers allows you to do a sort of multi-threading, Geolocation) • Drag-and-drop functionality (HTML 5 is built-in Chrome for instance and you can drag and drop supported file and add them to the map) • It runs natively any web browsers (the latest version) and on mobile (but not on all of them) • All the latest version of the major browsers supports HTML5.

Important Info: There is no ArcGIS API for HTML5

Here is an example of the simplification that HTML5 is coming with: declaration specify the web browser about what version of HTML the page is written in. In the previous HTML versions, web developers had to specify as follows: In HTML5, web developers need to specify the DOCTYPE as follows: . As you can see, HTML5 is simplifying the whole process of web application development. More information on semantic tags, new input types can be found here: http://www.w3schools.com/html5/tag_doctype.asp

© 2015 UNIGIS 10 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

There are several HTML5 APIs: • Drag and Drop API: let’s you drag and drop files or objects: images, .csv • FileSystem API • Geolocation API: provides users’ location • Web Workers (threaded JavaScript): provides simple way to run scripts in background thread • Browser History: navigate back and forth through the history To see a live example of one of this HTML5 APIs, go to Esri ArcGIS Resource Center- ArcGIS API for JavaScript, choose HTML5 and open „Geolocation and CSS Animation“. You will be prompted with a message asking you whether you want to share your location. Accept it and you’ll get your approximate location displayed on the map. As you can see in the HTML5 Geolocation Code Snippet presented above, there are two methods for getting users’ location: • getCurrentPostion: return users’ locations • watchPosition: track users positions when moving (appropriate for Mobile Applications)

© 2015 UNIGIS 11 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

ArcGIS Online incorporates besides ArcGIS API for JavaScript functionalities also HTML5 features. In Lesson 04, you’ve been using ArcGIS.com Map Viewer to create a new web map application by adding layers from web and from file. ArcGIS.com Map Viewer is a JavaScript web application that incorporates also some functionalities from HTML5 such as: • Drag and drop built-in: when add data from file, try to drag the files from your desktop into the web browser • Gradual blending of the tiles: zoom in and out a basemap in ArcGIS.com Map Viewer • Detection features window informing you that drag & drop functionality is not working: degrade your browser to an older version and try to drag and drop a file from your desktop to the web browsers.

© 2015 UNIGIS 12 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

Now, think about the questions stated on the slide - do you know the correct answers?

© 2015 UNIGIS 13 www.unigis.net UNIGIS Module: ArcGIS for Server University of Salzburg Lesson: Consuming GI Services – API’s

Esri ArcGIS Resource Center Web APIs: http://resources.arcgis.com/en/communities/web/ [last accessed on 28.03.2015]

© 2015 UNIGIS 14 www.unigis.net