how can i load a map with url

97
2
Jump to solution
07-11-2022 09:31 AM
stivenstiven
New Contributor III

I have implemented to load the map with the id of the map in this way: 

 

 

  initializeMap(): Promise<any> {
    const container = this.mapViewEl.nativeElement;
    const webmap = new WebMap({
      portalItem: {
        id: 'e781f03655844e2ab9123343d21cf1'
      },
    });
    const view = new MapView({
      container,
      map: webmap
    });
    this.webmap = webmap;
    this.view = view;
    return this.view.when();
  }

 

now I need to load a map that is in url, how can I do it by loading the map with url ?

https://utility.arcgis.com/......../FeatureServer/0

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor II

That endpoint is a FeatureService, but the utility endpoint is different. Assuming you have a FeatureService, you can use a FeatureLayer and add it to the Map.

Here is the doc

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html

Here's a tutorial on the subject as well.

https://developers.arcgis.com/javascript/latest/add-a-feature-layer/

View solution in original post

0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor II

That endpoint is a FeatureService, but the utility endpoint is different. Assuming you have a FeatureService, you can use a FeatureLayer and add it to the Map.

Here is the doc

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html

Here's a tutorial on the subject as well.

https://developers.arcgis.com/javascript/latest/add-a-feature-layer/

0 Kudos
stivenstiven
New Contributor III

Thank you very much, that's what I was looking for

0 Kudos