Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Building a Web Map with the Esri JavaScript API

Building a Web Map with the Esri JavaScript API

Lightweight web map built with the ArcGIS JS API and local GeoJSON layers. ArcGIS JS API • GeoJSON • HTML

Stack: ArcGIS JavaScript API, HTML, GeoJSON
Data: Local GeoJSON layers (boundaries, lines, points)
Goal: Build an embeddable web map with clean styling, widgets, and popups

Live Webmap

If the embed does not load, click here.

Project Overview

This project is a lightweight web map that uses the ArcGIS JavaScript API to render local GeoJSON layers. It focuses on clean symbology, quick loading, and a simple HTML-based setup you can run on a local server.

What This Project Does

Project Structure

Tools and Dependencies

How the Map Is Organized

Inside webmap.html the code is organized into small functions:

Each function builds a GeoJSONLayer with:

Widgets are added in a dedicated addWidgets(view) function.

Data Layers

The project uses five GeoJSON layers:

Each layer expects specific attribute fields in the GeoJSON. If a field name changes, the renderer or popup will break until updated.

Setup and Run

  1. Place the project folder under your local web server htdocs.

  2. Start Apache.

  3. Open the map in your browser. Example:

    • http://localhost/esri_jv_api/esri_javascript_api/webmap.html

Avoid opening the file directly with file:// because browsers block local file requests.

Key Implementation Steps

  1. Load the ArcGIS JS API in the HTML head.

  2. Create a Map and MapView.

  3. Build GeoJSONLayer instances with renderers and popup templates.

  4. Add the layers to the map.

  5. Add UI widgets like LayerList, Legend, Search, and Locate.

Common Issues and Fixes

Why This Approach Works

The ArcGIS JS API handles all rendering in the browser. GeoJSON files provide a simple, local data format that is easy to edit and version. This makes it a clean starting point before moving to hosted feature services or more complex GIS infrastructure.

Next Steps