ArcGIS Maps SDK For JavaScript — A Very Surface-Level Introduction

Inspired by the California URISA’s “Mappy Hour”

Evan SooHoo
3 min readMar 7, 2023
Source: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-collection-edits. According to the Esri Terms Of Use, the information above may be reproduced for educational and noncommercial purposes.

At $100 a year, ArcGIS is a somewhat expensive mapping software used by 350,000 organizations. I had the pleasure of attending “Mappy Hour” in Sacramento, an open event sponsored by California URISA and intended for people passionate about ArcGIS.

The pun alone was already worth it.

I learned more about the community and the wide range of use cases it has for state and government workers, but it also made me realize how much of a gap there is between people who actually use products like ArcGIS Online, and people who use the maps SDK.

What this post will be:

  • A very brief overview of some of the things you can do with the JavaScript SDK

What this post will not be:

  • A comprehensive guide to the JavaScript SDK
  • A post about the actual core product that you can pay for and use, possibly without having to do any actual coding yourself

Some Code

You can actually check this out right now here, if you’d like. This is sandbox code from devleopers.arcgis.com.

The simplest thing you can do with the ArcGIS SDK is display a map. Notice that their first JavaScript code references Esri — this is importing the SDK itself.

The map is pulled from ArcGIS online.

The interesting part is here:

To put it as succinctly as possible, ArcGIS provides the user with mapping abilities. Before the above, the user takes his/her already created map, creates an array of graphics, and invokes applyEdits to add or remove features. These are the two capabilities the user has in the CodePen example — add seven features, or remove seven features.

But the code above is not just useful as an example for how to add or remove features — it is also a good window into how JavaScript promises work. A promise, in JavaScript, represents the eventual completion or failure of an asynchronous operation. Then() schedules callback functions for the aforementioned promise.

Why are we using promises? Because we have to. ApplyEdits is a function that very explicitly returns a promise.

The code above is a simple use case in the sense that the remove button simply removes everything, but you can get more granular. For example, this Esri forum questioner actually builds a custom query. You could hypothetically just filter for specific locations, or choose some specific attribute and remove/filter that way.

New Goal/Random Thoughts

My new life objective is to be taken seriously by the ArcGIS community. This may prove challenging, as they mostly use the actual core product.

Though the product costs money, I was able to at least do a few basic things on ArcGIS online. I already noticed it had a few impressive features, such as:

  • The ability to upload a CSV
  • The ability to select two columns in said CSV, one to act as longitude and the other as latitude
  • The ability to automatically map the data in the CSV, then customize the points in the map accordingly

This alone could already make for a good hypothetical project. Create something with JavaScript that mimics this small amount of functionality. A user, on a map, can upload a file and then automatically map the uploaded data.

The plan is to call it corGIS, I just haven’t figured out what the ‘cor’ stands for yet.

--

--

Evan SooHoo
Evan SooHoo

Written by Evan SooHoo

I never use paywalls (anymore) because I would get stuck behind them.

No responses yet