Select to view content in your preferred language

Setting Initial Extent

2219
2
Jump to solution
02-15-2016 08:10 AM
EdwardDean
Emerging Contributor

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
Frequent Contributor
// 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
Frequent Contributor
// 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
Emerging Contributor

Thank you very much! This worked

0 Kudos