Setting Initial Extent

2054
2
Jump to solution
02-15-2016 08:10 AM
EdwardDean
New Contributor II

I am new to Javascript and working with the ArcGIS for Javascript API. I recently completed an abbreviated version of the Developing Web Apps with ArcGIS, API for Javascript course and I am going back through the lesson for review. I am trying to set the initial extent in a lesson and it is not working. I don't know what I am doing wrong. Any help would be greatly appreciated.

Thanks in advance.

Ed Dean

1 Solution

Accepted Solutions
thejuskambi
Occasional Contributor III
// Create the map
      mapMain = new Map("cpCenter", {
        basemap: "satellite",
        extent: "extentInitial"
      });

you are passing the variable as string. you need it as below

// Create the map
      mapMain = new Map("cpCenter", {
        basemap: "satellite",
        extent: extentInitial
      });

View solution in original post

2 Replies
thejuskambi
Occasional Contributor III
// Create the map
      mapMain = new Map("cpCenter", {
        basemap: "satellite",
        extent: "extentInitial"
      });

you are passing the variable as string. you need it as below

// Create the map
      mapMain = new Map("cpCenter", {
        basemap: "satellite",
        extent: extentInitial
      });
EdwardDean
New Contributor II

Thank you very much! This worked

0 Kudos