A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/javascript/latest/sample-code/layers-portal/ below:

Create a layer from a portal item | Sample Code | ArcGIS Maps SDK for JavaScript 4.33

This map depicts US Poverty and Political Leanings by counties. It does this by creating a FeatureLayer instance from an existing portal item and adds 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.

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
// Creates a layer from a Portal layer item id
Layer.fromPortalItem({
  portalItem: {
    id: "af1ad38816814b7eba3fe74a3b84412d",
  },
}).then((layer) => {
  // Adds layer to the map
  map.add(layer);
});

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.

Please refer to the ArcGIS Organization portals for information on how the ArcGIS Maps SDK for JavaScript makes use of working with portal items.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4