- 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:

- Practical Data Analysis Cookbook
- 零基礎學C++程序設計
- C語言程序設計基礎與實驗指導
- Hands-On Data Structures and Algorithms with JavaScript
- 深入理解Java7:核心技術與最佳實踐
- 編寫高質量代碼:改善C程序代碼的125個建議
- 征服RIA
- PostgreSQL Replication(Second Edition)
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(1)
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(2)
- 精通MySQL 8(視頻教學版)
- JavaScript程序設計:基礎·PHP·XML