Create a layer from a portal item

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

This map depicts US Poverty and Political Leanings by counties. It does this by creating a FeatureLayer instance from an existing portal item and add it to a basic Map in a SceneView. When an item is loaded as a layer, the Renderer and PopupTemplate saved to the layer in the portal are preserved in the application.

To load a layer from a portal, you must use its portal ID.

// Creates a layer from a Portal layer item id
Layer.fromPortalItem({
  portalItem: {
    id: "af1ad38816814b7eba3fe74a3b84412d"
  }
}).then(function(lyr){
  // Adds layer to the map
  map.add(lyr);
});

The renderer of the layer in this app uses several visual variables, that were set in the ArcGIS Online Map Viewer and saved to the layer. So there is no need to set a custom renderer in code.

Sample search results

TitleSample

There were no match results from your search criteria.