I should have said :"I don't if it is because I use a spatial reference which doesn't have a wkid or if it is anything else..."Of course, I have a spatial reference, but a custom one :
this.sr = new esri.SpatialReference({ "wkt":'PROJCS["NTF_Lambert_Zone_II",GEOGCS["GCS_NTF",DATUM["D_NTF",SPHEROID["Clarke_1880_IGN",6378249.2,293.46602]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",600000.0],PARAMETER["False_Northing",200000.0],PARAMETER["Central_Meridian",2.3372291667],PARAMETER["Standard_Parallel_1",45.8989188889],PARAMETER["Standard_Parallel_2",47.6960144444],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",46.8],UNIT["Meter",1.0]]'
});
The spatial reference is a copy/paste of the map service definition.My code :Please note that mm is a reference to a MapManager (custom), the member map an esri.Map object. I can't post the whole application (too big!).zoom_query: function(layerName, fieldName, id, scale, outFields){
var query = new esri.tasks.Query();
if (typeof(id) == 'string') id = "'"+id+"'";
query.where = fieldName+" = "+id;
query.returnGeometry = true;
if (outFields !== undefined){
query.outFields = outFields;
}
var thisref = this;
var l = this.mm.getLayerByName(layerName);
if (l == null){
alert("zoom_query->Layer "+layerName+" don't exist");
return;
}
l.queryFeatures(
query,
function(featureSet){
var r = featureSet.features[0];
if (thisref.apv.type == 'Point'){
var zoomLevel = thisref.mm.map.setLevel(thisref.mm.getScaleLevel(thisref.apv.scale));
thisref.mm.map.centerAndZoom(r.geometry, zoomLevel);
}
thisref.mm.showInfoWindow(r);
},
onError
);
}
}
So, I just retrieve a point and zoom on it. The scale level is defined in the basemap, which is not displayed at this time. The failure comes from a dynamic map service.Kind regards,FL