Select to view content in your preferred language

Issue Loading Web Map from Portal using Web Components

148
2
a month ago
dgreenin
Emerging Contributor

I am currently encountering an issue loading a web map from an ArcGIS Enterprise Portal using ArcGIS JavaScript web components.

Are there examples available for succesfully loading a web map from an Enterprise Portal?

0 Kudos
2 Replies
ReneRubalcava
Honored Contributor

This is going to depend on how you are building your app. Here is some documentation showing the steps to set up the esriConfig portal url.

https://developers.arcgis.com/javascript/latest/programming-patterns/#set-the-portalurl-in-an-amd-ap...

https://developers.arcgis.com/javascript/latest/programming-patterns/#set-the-portalurl-in-an-esm-ap...

If you are building your app from scratch with npm, I would recommend you set up the esriConfig portal url, and any auth needed before loading your components, so something like this.

esriConfig.portalUrl = something;
esriId.registerOAuthInfos([info]);
import("@arcgis/map-components/dist/loader").then(
    ({ defineCustomElements }) => {
      defineCustomElements();
    },
);
0 Kudos
dgreenin
Emerging Contributor

@ReneRubalcava 

Thank you for your quick response!

After taking a second look at the links you provided, I was able to adjust the script and successfully load the web map of interest.

0 Kudos