Steps:
- Install ArcGIS Portal 10.4,server 10.4,datastore, Webadaptor for IIS, build the ArcGIS API for JavaScript 4.3 environment, the specific configuration process Baidu, do not repeat this.
- Set the Portal language: My organization, edit settings, general-language, select "Chinese Simplified";
- Publish layers: Publish a Test service named Point,line,polygon in ArcGIS Pro 1.4, where you can perform mapping operations such as unique value rendering for each layer;
- Configure the map: In the Map tab of the portal, add a basemap, then locate the point, line, polygon three layers, add to the map, select the Save button, and save the configured map. You can see the configured map in my content now.
- Use the JS API to load WebMap: The code is as follows
1 varMap,webmap,view,tilelyr;2 require ([3"Esri/map",4"Esri/webmap",5"Esri/views/mapview",6"Esri/layers/vectortilelayer",7"Dojo/domready!"8],function(Map,webmap, Mapview, Vectortilelayer) {9 Ten //Create a Map OneMap =NewMap (); Awebmap=NewWebMap ({ -Portalitem: {//autocasts as New Portalitem () -ID: "Ea75705fbf3f40639de492578d247fae" the } - }); - //Make map view and bind it to the map -View =NewMapview ({ +Container: "Viewdiv", - Map:webmap, + AZoom:10 at});
View CodeProblems encountered:
- After configuring Portalurl in Esri/config.js, the map service address in the Web page still points to www.arcgis.com
- Workaround: Modify the first portalurl in Init.js and change to the local portal address Https://xxx.xxx.com/arcgis
- HTTPS://WWW.XXX.COM/ARCGIS/SHARING/REST/PORTALS/SELF?F=JSON&CULTURE=ZH-CN this address prompts 404 error, cannot find content,
- Workaround: Manually copy this address to the browser, and if you are prompted for "unsafe", continue to access until the content is available.
- At this time the Web page should be able to load out the map, congratulations!!!
Invoking the WebMap published by the local portal using ArcGIS Api for Javascript