Select to view content in your preferred language

Access Basemap Value

847
3
Jump to solution
02-04-2013 05:32 PM
ChrisSeeger
Occasional Contributor
I would like to access and reset the value for the basemap and zoom via a javascript form field. my question is how to I access these. I am able to acces the map width but not these three items.

  function init() {
      map = new esri.Map("map", {
        center: [-31.036, 42.747],
        zoom: 8,
        basemap: "streets"
      });
0 Kudos
1 Solution

Accepted Solutions
ChrisSeeger
Occasional Contributor
Found this in the whats new at 3.3
Two new map methods, getBasemap and setBasemap, make switching basemaps easy. setBasemap accepts one of the strings mentioned....

http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/#whats_new

View solution in original post

0 Kudos
3 Replies
StephenLead
Honored Contributor
I would like to access and reset the value for the basemap and zoom via a javascript form field. my question is how to I access these. I am able to acces the map width but not these three items.

  function init() {
   map = new esri.Map("map", {
   center: [-31.036, 42.747],
   zoom: 8,
   basemap: "streets"
      });



You can get to the array of basemaps using map.basemapLayerIds, so the first basemap will be map.basemapLayerIds[0]

map.getZoom() will return the zoom level while map.setZoom(10) will set the level.

Cheers,
Steve
0 Kudos
ChrisSeeger
Occasional Contributor
Found this in the whats new at 3.3
Two new map methods, getBasemap and setBasemap, make switching basemaps easy. setBasemap accepts one of the strings mentioned....

http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/#whats_new
0 Kudos
StephenLead
Honored Contributor
Cool, that looks much easier.
0 Kudos