- Mastering ArcGIS Server Development with JavaScript
- Ken Doman
- 245字
- 2021-07-16 20:03:01
The map object
Now that we have the components, we need to create an interactive map; let's put them together. We'll start by constructing a map
object, which provides the basis and interaction platform that we'll need to work with. The map constructor takes two arguments. The first parameter, either the HTML node or the id
string of a node, indicates where we want to put our map. The second parameter of the map constructor is an options
object, where we add the configurable options that make our map work as expected:
function ( Map, ArcGISDynamicMapServiceLayer, IdentifyParameters, IdentifyTask, InfoTemplate, arrayUtils ) { var map = new Map("map", { basemap: "national-geographic", center: [-95, 45], zoom: 3 }); });
In the preceding code, we're creating a map in the div
element with an id
of map
. In the map, we're adding a basemap, or a background reference map, in the style of National Geographic. We're centering the map at 45°N and 95°W, at a zoom level of three. We'll go into greater depth concerning these configurations in later chapters. If you're using a desktop browser to view the results, you should see the United States, including Alaska, and Hawaii, as in the following image:

- JavaScript前端開發(fā)模塊化教程
- Delphi程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- Moodle Administration Essentials
- 摩登創(chuàng)客:與智能手機(jī)和平板電腦共舞
- 機(jī)器人Python青少年編程開發(fā)實(shí)例
- Java Web基礎(chǔ)與實(shí)例教程
- Node.js:來一打 C++ 擴(kuò)展
- Microsoft Azure Storage Essentials
- Python大學(xué)實(shí)用教程
- Android應(yīng)用開發(fā)實(shí)戰(zhàn)
- 跟戴銘學(xué)iOS編程:理順核心知識點(diǎn)
- Delphi開發(fā)典型模塊大全(修訂版)
- ASP.NET Web API Security Essentials
- Maven for Eclipse
- PHP Microservices