ArcGIS API for JavaScript 4.2 study notes [2] Show Map

Source: Internet
Author: User

3D maps are also called scenes.

From the previous article,

The first argument to the Require entry function is a string array

["Esri/map", "Esri/views/mapview", "dojo/domready!"]

Here, Mapview is the map view of 2D.

So, to change the map to 3D map, it is very simple, just need to change the string array of the second reference to "Esri/views/sceneview"

Then modify the corresponding view code in the second parameter.

A new code for the second parameter (function) is given below

function (map, Sceneview) {  varnew  Map ({    "OSM",     "world-elevation "  });//still using the OSM  base map varnew  Sceneview    ({" Viewdiv "  ,         Map:map,                   50000000,             Center: [113.5, +]   });//scale 1:50 million}

As you can see here, the View object is not the Mapview class, but the Sceneview class.

And there's a new thing--ground in the Map object constructor.

Here is the ground information:

The ground property is surface data, which can be an instance of the ground class.

The following is the Sceneview class information:

Sceneview and Mapview also inherit from the view class. Sceneview

In the same way, give the full HTML code:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Viewport"content= "initial-scale=1, maximum-scale=1, User-scalable=no"><title>Get started with sceneview-create a 3D map</title><style>html, body, #viewDiv{padding:0;margin:0;Height:100%;width:100%;  }</style><Linkrel= "stylesheet"href= "Https://js.arcgis.com/4.2/esri/css/main.css"><Scriptsrc= "HTTPS://JS.ARCGIS.COM/4.2/"></Script><Script>require (["Esri/map",  "Esri/views/sceneview",  "dojo/domready!"], function(Map, Sceneview) {varMap= NewMap ({basemap:"OSM", Ground:"world-elevation"  }); varView= NewSceneview ({container:"Viewdiv", Map:map, scale:50000000, center: [113.5,  -]    });});</Script></Head><Body>  <DivID= "Viewdiv"></Div></Body></HTML>
Show Map

The running success is probably like this (slightly modified scale of 150,000, coordinates of 114.3 and 30.5 Yes, it is Wuhan)

PS: If you feel like a plane can be the scale back to 500w or 1000w, the ground fluctuation is not obvious can be adjusted basemap for other maps, coordinates to the mountains.

ArcGIS API for JavaScript 4.2 study notes [2] Show Map

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.