Book Image

Learning D3.js Mapping

Book Image

Learning D3.js Mapping

Overview of this book

Table of Contents (14 chapters)
Learning D3.js Mapping
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Finding and Working with Geographic Data
Index

AJAX


AJAX (Asynchronous JavaScript and XML) doesn't relate 100 percent to D3. It actually has its foundation in JavaScript. In short, AJAX allows the developer to obtain data from the background of the web page. This technique is extremely useful in map development because geographic datasets can be very large. Acquiring the data from the background will help produce a refined user experience. In addition, in Chapter 6, Finding and Working with Geographic Data, we will cover techniques to compress the size of geographic data.

Separating the data from the code base will also provide the following advantages:

  • A lighter code base that is easier to manage

  • The ability to update the data without making code changes

  • The ability to use third-party providers for data sources

This is accomplished by acquiring the data through an AJAX call with the aid of a D3 function. Let's examine the following code:

d3.json("data/dataFile.json", function(error, json) {

The d3.json method has two parameters: a path to...