GeoJSONLayer

Explore in the sandboxView live

The GeoJSONLayer allows you to add features from a GeoJSON file (.geojson). The file is referenced as a hosted file on the web. Because of this, the file must be publicly accessible.

This sample shows how to add an instance of GeoJSONLayer to a Map in a MapView. The resulting point features can be queried via the API and then subsequently used as input for other operations.

If GeoJSON files are not on the same domain as your website, a CORS-enabled server or a proxy is required.

How it works

This sample accesses real-time data from the USGS.

Create a new GeoJSONLayer and set the properties within its constructor. In this specific example, the url to the USGS earthquakes live feed is added in addition to the copyright and popupTemplate properties.

1
2
3
4
5
const geojsonLayer = new GeoJSONLayer({
  url: url,
  copyright: "USGS Earthquakes",
  popupTemplate: template
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close