Select to view content in your preferred language

upgrading api from 3.2 to 3.5 causing error "map.spatialReference undefined"

575
1
09-12-2013 11:42 AM
JoanSteinbacher
Occasional Contributor
In trying to upgrade the api, I'm getting an error on this line:
console.log(esri.geometry.getScale(map.extent, map.width, map.spatialReference.wkid));

which is called after the following:

    configExtent = {
     "xmin" : -9215700,
     "ymin" : 3216400,
     "xmax" : -9119800,
     "ymax" : 3256100,
     "spatialReference" : {
      "wkid" : 102100
     }
    };

 var initialExtent = new esri.geometry.Extent(configExtent);

 var lods = configLods;

 var popup = new esri.dijit.Popup(null, dojo.create("div"));

 //Set map parameters.
 map = new esri.Map("map", {
  extent : initialExtent,
  logo : false,
  infoWindow : popup,
  slider : true,
  sliderStyle : "default", //use 'small' if you want just the +/- icons
  nav : true, //shows the pan buttons.
  lods : lods, //sets the navigation slider to the specified levels.
  showAttribution : false
 });


Has something changed in 3.5 to make this not work? 

Thanks,
Joan
0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor
What happens if you put that line inside the map's load event? I would sometimes have problems when calling a map's properties before it had time to load.
0 Kudos