Invoking the WebMap published by the local portal using ArcGIS Api for Javascript

Source: Internet
Author: User

Steps:

  1. 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.
  2. Set the Portal language: My organization, edit settings, general-language, select "Chinese Simplified";
  3. 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;
  4. 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.
  5. 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 Code

    Problems encountered:

      1. After configuring Portalurl in Esri/config.js, the map service address in the Web page still points to www.arcgis.com
      2. Workaround: Modify the first portalurl in Init.js and change to the local portal address Https://xxx.xxx.com/arcgis
      3. HTTPS://WWW.XXX.COM/ARCGIS/SHARING/REST/PORTALS/SELF?F=JSON&CULTURE=ZH-CN this address prompts 404 error, cannot find content,
      4. Workaround: Manually copy this address to the browser, and if you are prompted for "unsafe", continue to access until the content is available.
  6. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.