I am updating an existing web application from version 1.5 to 2.1 of the ArcGIS JavaScript API.After pointing my page to the version 2.1 API URL I noticed that the Map.spatialReference property is set to an esri.SpatialReference object with null values for both the wkid and wkt properties. As a result, when the Map.onClick event is fired, the mapPoint property does not have a valid spatial reference and attempting to use the mapPoint with the Identify task will fail.When using version 1.5, the Map.spatialReference property returned the same spatial reference as the first layer added to the map.Was this change intentional, or is this a bug?function doIdentify(evt) {
////// Worked under version 1.5, but not under 2.1 due to mapPoint's spatialReference property being invalid.
////identifyParams.geometry = evt.mapPoint;
identifyParams.geometry = new esri.geometry.Point(evt.mapPoint.x, evt.mapPoint.y, bgLayer.spatialReference);
identifyParams.mapExtent = map.extent;
// idResults is an out parameter created by the identify task's onComplete event.
identifyTask.execute(identifyParams, function(idResults) { onIdentifyExecutionComplete(idResults, evt); });
}
function map_onLoad(map) {
dojo.connect(map, "onClick", doIdentify);
}