Skip To ContentArcGIS for DevelopersSign In Dashboard
Loading...

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

TitleSample
Loading...