Chapter 2. Layers and Widgets

The two basic components that make up our web mapping application are layers and widgets. A map object is similar to a canvas that holds all the layers, and users can interact with it, such as panning and zooming into the map. Layers are primarily associated with a particular data source. Widgets are composed of JavaScript logic and an HTML template (if it requires user interaction). Widgets can interact with the map or can function independently. Esri has developed a lot of general-purpose widgets, and these are bundled with the API. We will discuss how to use these widgets throughout this book. We will also see how to develop custom widgets in the next chapter. This chapter sets the starting point in the development of a full-fledged web mapping application displaying historical earthquake data. We will be gaining a strong foothold in the following topics as we progress through the chapter:

  • Data sources supported by the API
  • The concept of layers in the context of the API
  • The functional classification of layers
  • The different types of layers and their properties
  • Featurelayers versus DynamicMapService versus graphics layer
  • Using Esri's in-built widgets

Data sources supported by the API

The ArcGIS JavaScript API is a powerful and flexible client-side mapping software that provides support for integrating a variety of spatial data sources, which is currently in production. It also provides support for visualizing flat file formats, such as CSV, with some latitude and longitude information.

In order to leverage full capabilities provided by the ArcGIS JavaScript API, it is important to know the list of data sources it supports and the properties and methods it exposes.

The data sources supported by the ArcGIS JavaScript API as of version 3.14 can be broadly grouped as follows:

  • ArcGIS Server services
  • OGC compliant GIS services
  • Flat file formats
  • Custom web services (preferably REST services)

Let's review the different data source formats and understand how to get the necessary information about the data to consume in the ArcGIS JavaScript API.

Flat file formats

The API provides native support to render flat file formats such as KML and CSV.

KML

Keyhole Markup Language (KML) is a spatial file format that was initially developed by Google and is currently maintained by OGC. It provides support for point, line, and polygon geometry, and even image overlays. KML is an XML well known for this versatility, but it is pretty verbose and is used in Google Maps. KML files can be opened in any text edit such as Notepad++.

CSV files

The CSV file is a plain text file format that stores tabular data with field values separated by commas. CSV files contain information about latitude and longitude or coordinate values such as X and Y coordinates in separate fields. A CSV file can be read by the API, and the location information can be converted to point to the location on the API.

ArcGIS Server

ArcGIS Server can be used to share spatial data over the Web. In our case, if we have data as shape files, personal geodatabases, file geodatabases, or enterprise geodatabases, we can use ArcGIS Server to serve the data over the Web as REST services. ArcGIS JavaScript is capable of consuming these services and displaying them onto the map. In case of other spatial formats, such as DWG, we can either use the ArcGIS desktop or Feature Manipulation Engine (FME), which is a spatial ETL tool for converting into the Esri file format and publishing it via ArcGIS Server.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.157.39