I'm new to ESRI Map. I'm working on latest version of JavaScript API.

I'm trying to load GeoJSON from this link into my Map. I'm able to load GeoJSON from ESRI Feature Service URL.

I wanted to load GeoJSON from an object. My code goes like this.

    ], function(
      Map, MapView, FeatureLayer, Legend
    ) {

      var defaultSym = {
        type: "simple-fill", // autocasts as new SimpleFillSymbol()
        outline: { // autocasts as new SimpleLineSymbol()
          color: "lightgray",
          width: 0.5

      var renderer = {
        type: "simple", // autocasts as new SimpleRenderer()
        symbol: defaultSym

      var map = new Map({
        basemap: "streets"

      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-85.050200, 33.125524],
        zoom: 4

      var usOutline = ...... A single feature from the feature collection in link.
      var featureLayer = new FeatureLayer({
        source: usOutline.geometry,
        title: 'Hello',
        geometryType: "Polygon",
        renderer: renderer



How can I load the GeoJSON?


Check out this code snippet/post:

Importing GeoJSON data in ArcGIS Javascript maps

function requestData() {
  var requestHandle = esriRequest({
    url: "data/sample.json",
    callbackParamName: "jsoncallback"
  requestHandle.then(requestSucceeded, requestFailed);

function requestSucceeded(response, io) {
  //loop through the items and add to the feature layer
  var features = [];
  array.forEach(response.features, function(item) {
    var attr = {};
    //pull in any additional attributes if required
    attr["some_other_field"] = item.properties.<some_chosen_field>;

    var geometry = new Point(item.geometry.coordinates[0], item.geometry.coordinates[1]);

    var graphic = new Graphic(geometry);

  featureLayer.applyEdits(features, null, null);

function requestFailed(error) {
| improve this answer | |
  • Thank you so much for the effort. Unable to plot geojson with this code. This plot's points from the each co-ordinates in geojson. Moreover this doesn't support version 4.7. – Vignesh Gopalakrishnan Jul 9 '18 at 5:17

Use GeoJSONLayer for this task:


  var stuffLayer = new GeoJSONLayer({
        url: "https://eric.clst.org/assets/wiki/uploads/Stuff/gz_2010_us_040_00_500k.json"

  var map = new Map({
    basemap: "streets",
    layers: [stuffLayer]

Read more here: https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson/index.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.