element with the following attribute values:
id basemapGallery
style overflow:scrol1;
‘This DIV will hold the basemap gallery. You will now add TitlePanes to organize the basemap
gallery and separate it from the Find Features button.
Add two more
elements, each with a dojotype attribute set to [Link]:
* Position the opening and closing tags for one of these element where the BasemapGallery dijit
should display.
Once configured, the Basemap Gallery dijit must be started before it will function on the page.
Gi For the final line of code in your createBasenapGallezy () function, call the staztup()
‘method on your basemapGallery object.
Copyright © 2071 Es 223Gating started withthe ArcGIS API for JavaScript
‘You need to call your new function as part of your application's initialization process.
© Atthe end of your init () function:
= Call your createBasemapGallery () function.
Q Switch to the IE tab.
Click the Switch Basemap title to expand the pane.
O Click a few basemaps to test the Basemap Gallery's functionality
Q Save your application, if necessary.
228 Copyright © 2011 Esa
2IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIGFPIDIFDIDDFDIOD DODD HOD DDD DDI DODD HDD IIIAIFIIFIIIFIIIIIIIMI
Lesson?)
Lesson review
1. What functionality is included in the JavaScript API?
2. What is the Services Directory? How is it used in conjunction with the JavaScript API?
3. What information is presented in the API Reference?
Copyright © 2011 Es
2.25Getting started withthe ArcGIS API for JavaScrict
Answers to Lesson 2 questions
Accessing service information
1. What are the values for the following properties of the World_Street_Map service:
‘htip:/ /[Link]/ ArcGIS rest/services/ World_Street Map/MapServer
# of Layers 1
Spatial Reference 102100 (3857)
Single Fused Map Cache [true
# of Levels of Details (scales) | 18
Tile format JPEG
Units of Coordinate System | esriMeters
(2. What are the values for the following properties of ESRI_Population_World (MapServer):
ttp:/ /[Link] ArcGIS /rest services / Demographics
ESRI Population_World/ MapServer
# of Layers 1
Spatial Reference 4326
‘Single Fused Map Cache —_| false
# of Levels of Details (scales) | n/a
Tile format nla
Units of Coordinate System | esriDecimalDegrees |
226
Copyright © 2011 Essi
PIFDIDFIFIFPIIIIIIIIIIIIPIPIIIIIIIIIIIIIIINIIIIIIIIIMap service overlay comparison chart
1. Which map service coordinate system and tiling combinations will display properly?
(¥ = overlay will draw on map; N = overlay will NOT draw on map)
Basemap Layer (TILEDor DYNAMIC)
ener neni
Exercise 2: Create a simple mapping application
1. Using the API Reference as a guide, complete the following code to load the module for the
Map class (the syntax is provided in the Description section):
[Link] (“[Link]") ;
2. In which section of your code will you load the map module?
“Requires and Functions -->
3. What is the value for the id attribute of this DIV element?
map
Copyright ©2011 Ess 227
DIDIFFDFDIDHD PDP DID DID IID DISD HOD IIIDIIIIIIIFIFIHIIFIIIIIIIIIGetting started with the ArcGIS API or JavaScript
4, Is the World Street Map service cached or dynamic?
This is a cached (or tiled) map service.
5. Complete the syntax below for the object constructor:
esti. layers ArcGISTiledMapServiceLayer (url, options?)
6. Isthe service cached or dynamic?
Dynamic
7. What is the name of the constructor for this class?
esri. layers ArcGISDynami MapServiceLayer ()
8. Ifan array contains two elements, what is the JavaScript syntax for passing this array asa
parameter to a method?
object method ([array_elenent1, array_elenent2]) ;
Lesson review
1. What functionality is included in the JavaScript API?
Maps, graphics, tasks, and widgets
2. What is the Services Directory? How is it used in conjunction with the JavaScript API?
The Services Directory is a catalog of available GIS services on a server. Use it to access
REST endpoints and detailed information about services.
3. What information is presented in the API Reference?
Detailed descriptions for each class in the API (constructors, properties, methods,
events, etc.)
228 Copyright ©2011 Esri
PDIFIIIIIIIIIIPIIPIIIPIPIIIIIIIIIIIIIIIIIIIIIIII1
1
|
|
|
|
|
a
A
a
a
a
ea
a
a
a
a
a
a
a
a
a
a
a
a
a
a
e
a
a
a
a
a
“
a
e
a
a
A
a
a
e
a
a
a
a
a
a
a
a
a
a
a
Exercise solution
Note: For printing purposes, some lines of code in this solution may wrap.
‘Step: Reference ArcGIS API for JavaScript CSS and JavaScript libraries
true };
/48/do}0/dijit/thenes/claro/[Link]">
‘stylesheet type="text/css"
‘http: //[Link]/BAAJ/styles/css/BAAJ_Clean.css">
href:
Step: Add a map
Copyright © 2011 Ese
229Getting started with the ArcGIS API for JavaScript
Step: Set the default map extent
function init() {
var initialfxtent = new [Link]( {
“amin” :-13049000,
ymin" :4034000,
“smax" : 13041000,
ymax" : 4039000,
“spatialReference" :{""wkid" :102100}
ne
map = new [Link]("nap", { extent:initialExtent });
var basemap = new esri. [Link] (
“nttp: //[Link]/ArcGIS/rest
/services/World Street_Map/MapServer™) :
Step: Add an operational layer
var basemap = new [Link] (
“http: //[Link]/ArcGIS/rest.
/services/World_street_Map/MapServer") +
var operationalLayer = new esri. layers .ArcGISDynamicMapServiceLayer (
“http: //[Link] .com/ArcGIS/rest
/sexvices/Redlands PointsOfInterest/MapServer") ;
[Link] (|basemap, operationalLayer]) }
230 Copyright © 2011 Ess
PIDIIIIIIIIIIIIIIIIIIPIIIIIIFIIIIIIIIPIIIIIIIIDF FDFFFDIFDIDIDDID ID ADHD IIOP ODD DDO SDP SOD OHO DHIIIFAIIIIAHHNIIIIIII
Lesson
Step: Configure a basemap gallery widget
aun
Instagram
Facebook FacebookPinterest Pinterest