Can anybody explain me difference between url and portale ID in feature layer ??

07-21-2019 03:43 AM
New Contributor III

Thanks in advance

0 Kudos
1 Reply
MVP Regular Contributor


These are different ways of accessing data on a feature service.  PortalID is used when loading the layer via the portalitem property.  

// loads the third layer in the given Portal Item
const layer = new FeatureLayer({
  portalItem: {
    id: "8d26f04f31f642b6828b7023b84c2188"
  layerId: 2

The url method pointing the service and not the layer directly in the Feature Service.

// Can also be used if URL points to service and not layer
const layer = new FeatureLayer({
  // Notice that the url doesn't end with /2
  url: "",
  layerId: 2

Additional information is available at FeatureLayer | ArcGIS API for JavaScript 4.12 

The ID information can be viewed in the objects Jason using the ArcGIS Online Assistant as posted by Christopher Schreiber in the post How do I get the ID of a web map layer? 


To view a webmap's JSON:


2. Select the "I want to..." list in the top menu

3. Select "View an Item's JSON" from the list.

4. Select the map or Item from the lists on the left of the page.