You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {}
  • Firefox
  • Safari
  • undefined

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

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 publically 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.

var geojsonLayer = new GeoJSONLayer({
  url: url,
  copyright: "USGS Earthquakes",
  popupTemplate: template

Sample search results