Home » Posts tagged 'JavaScript'

Tag Archives: JavaScript

Building Web and Mobile ArcGIS Server Applications with JavaScript

Building web ArcGisArcGIS Server is the predominant platform used to develop GIS applications for the Web. There are a number of programming languages you can use to develop applications with ArcGIS Server, including JavaScript, Flex, and Silverlight. JavaScript has become the preferred language for developing applications on this platform, since it can be used for both web and mobile applications and doesn’t
require the installation of a plugin for the application to be used in a browser. Flex and Silverlight both fall short as languages for mobile development and both require the use of a plugin for the application to run in a browser.
This book will teach you how to build web-based GIS applications using the ArcGIS API for JavaScript. Using a practical, hands-on style of learning, you will learn how to develop fully functional applications with ArcGIS Server and develop a skill set that is in high demand.
You will learn how to create maps and add geographic layers from a variety of sources, including tiled and dynamic map services. In addition, you’ll learn how to add graphics to the map and stream geographic features to the browser using FeatureLayer. Most applications also include specific functionalities implemented by ArcGIS Server as tasks. You’ll learn how to use the various tasks provided by ArcGIS Server, including queries, identification of features, finding features by attributes, geoprocessing tasks, and more. Finally, you’ll learn just how easy it is to develop mobile applications with the ArcGIS API for JavaScript.

What this book covers
Chapter 1, Introduction to HTML, CSS, and JavaScript, covers fundamental HTML, CSS, and JavaScript concepts before getting started with developing GIS applications with the ArcGIS API for JavaScript.

Chapter 2, Creating Maps and Adding Layers, teaches you how to create a map and add layers to the map. You will learn how to create an instance of the Map class, add layers of data to the map, and display this information on a web page. The Map class is the most fundamental class in the API as it provides the canvas for your data layers and any subsequent activities that occur in your application. However, your map is useless until you add layers of data. There are several types of data layers that can be added to a map, including tiled, dynamic, and feature. Readers will learn more about each of these layer types in this chapter.

Chapter 3, Adding Graphics to the Map, teaches the reader how to display temporary points, lines, and polygons in GraphicsLayer on the map. GraphicsLayer is a separate layer that always resides on top of other layers and stores all the graphics associated with the map.

Chapter 4, The Feature Layer, offers additional capabilities, apart from inheriting from GraphicsLayer, such as the ability to perform queries and selections. Feature layers are also used for online editing of features. Feature layers differ from tiled and dynamic map service layers, because feature layers bring geometry information to the client computer to be drawn and stored by the web browser. Feature layers
potentially cut down on round trips to the server. A client can request the features it needs, and perform selections and queries on those features without having to request more information from the server.

Chapter 5, Using Widgets and Toolbars, covers out-of-the-box widgets that you can drop into your application for enhanced productivity. The BasemapGallery, Bookmarks, Print, Geocoding, Legend, Measurement, Scalebar, Gauge, and Overview map widgets are included. In addition, the ArcGIS API for JavaScript also includes helper classes for adding various toolbars to your applications, including
navigation and drawing toolbars.

Chapter 6, Performing Spatial and Attribute Queries, covers the ArcGIS Server Query Task, which allows you to perform attribute and spatial queries against data layers in a map service that have been exposed. You can also combine these query types to perform a combination attribute and spatial query.

Chapter 7, Identifying and Finding Features, covers two common operations found in any GIS application. These operations require that the user click a feature on the map in the case of identification, or perform a query in the case of finding features. In either case, information about particular features is returned. In this chapter, the reader will learn how to use the IdentifyTask and FindTask objects to obtain
information about features.

Chapter 8, Turning Addresses into Points and Points into Addresses, covers the use of the Locator task to perform geocoding and reverse geocoding. Geocoding is the process of assigning a coordinate to an address, while reverse geocoding assigns an address
to a coordinate.

Chapter 9, Network Analyst Tasks, allows you to perform analyses on street networks, such as finding the best route from one address to another, finding the closest school, identifying a service area around a location, or responding to a set of orders with a
fleet of service vehicles.

Chapter 10, Geoprocessing Tasks, allows you to execute custom models built in ArcGIS Desktop using ModelBuilder. Models are run in an automated fashion from either a desktop environment or via a centralized server accessed through a web application. Any tool found in ArcToolbox, whether that be a tool for your ArcGIS license level or a custom tool that you’ve built, can be used in a model and chained together with other tools. Once constructed, these models can be run on a centralized server and accessed via web applications. In this chapter, we will examine how you can access these geoprocessing tasks through the ArcGIS API for JavaScript.

Chapter 11, Integration with ArcGIS Online, details how you can use the ArcGIS API for JavaScript to access the data and maps created with ArcGIS.com. The website ArcGIS.com is for working with maps and other types of geographic information. On this site, you will find applications for building and sharing maps. You will also find useful basemaps, data, applications, and tools that you can view and use, plus
communities you can join. For application developers, the really exciting news is that you can integrate ArcGIS.com content into your custom developed applications using the ArcGIS API for JavaScript. In this chapter, you will explore how ArcGIS. com maps can be added to your applications.

Chapter 12, Creating Mobile Applications, details how you can build mobile GIS applications using the ArcGIS API for JavaScript. ArcGIS Server support is currently provided for iOS, Android, and BlackBerry operating systems. The API is integrated with dojox/mobile. In this chapter, you’ll learn about the compact build of the API that makes web mapping applications possible through web-kit browsers as well as
the built-in gesture support.

Appendix, Application Design with ArcGIS Templates and Dojo, covers one of the most difficult tasks for many web developers which is designing and creating the user interface. The ArcGIS API for JavaScript and Dojo greatly simplifies this task. Dojo’s layout dijits provide a simple, efficient way to create application layouts, and Esri has provided a number of sample application layouts and templates that you can use to get up and running quickly. In this appendix, the reader will learn techniques to design an application quickly.


ArcGIS Web Development


The last decade has seen a boom in people becoming acclimated to location technology. Most users may not fully realize that they’re using location technology when they get an alert on their phone that there’s traffic on the way home, or when they get a coupon from an app on their phone for a local restaurant. Smart phones are no longer simply devices for making phone calls, texting, and checking email. For many people, they’ve not only replaced the heavy and clumsy map book that your passenger used to help you navigate, but these “phones” have also replaced the expensive indash GPS systems in our vehicles. It’s so easy today to say the name of a store or venue into your phone, and in seconds receive turn-by-turn directions. That’s not to say that these directions may not try to direct you into a lake, but there’s no denying that location technology has become part of our daily lives. We gladly share our current locations with friends and family with as much fervor as when we shared a photo a few
years ago. Maps and the information they can convey are great tools that developers should take time to learn to use.
A few years ago, I was tasked with upgrading an enterprise GIS application and bringing it into the modern non-mainframe era. Esri had just started releasing Web APIs for use with their technology. At the time, I built my application with the Flex API, and I delved deep into the world of ActionScript and Flex modular development, but it always felt a bit heavy-handed.
Over time, the Esri JavaScript API became more appealing. It performed better with each release and offered new features that worked with the latest updates to ArcGIS Server. At some point, my focus switched entirely from Flex development to JavaScript, and I immersed myself in every nook and cranny of the API.

width: 0px; “> </I’ve had the pleasure over the years of building numerous applications with the ArcGIS API for JavaScript, even building a business around creating web-mapping applications. I’ve tried to follow each learning hump with a blog post or a presentation to share what I have learned. This is my way of paying it forward—paying it forward for all those blog posts I spent late nights digging through, simply to fix some odd bug or solve a problem I was ready to give up on, and for all the presentations I’ve attended that inspired me to build and learn, to create useful tools and applications, and to strive to learn what I didn’t even know I wanted or needed to learn. This book brings together the knowledge I’ve gained and puts it all in one place. I hope you enjoy reading this book as much as I did writing it.

I also hope you take the foundations laid out here to explore what you can do with web mapping with the ArcGIS API for JavaScript and build some really cool things. Because as developers, isn’t that what we all want to do? Just build.