I do. These are some pretty old map services made a few years ago that I thought were in WGS 1984 Aux Sphere (102100). When I studied them more closely, I realized they were in just WGS 1984, which is something like wkid 4326. I ended up going back and fixing my original MXD files and getting them into the projection I really meant for them to be in (102100). All that and it still wasn't working!!!I know it should have worked, but my end around was to create an array of adjacent county names from the original county service. Then I generated a rather elaborate where clause from that array and used that as input to my 2nd layer (both had county name fields) and got at the information that way.
function findAdjacentCounties(geometry) {
var queryTask = new QueryTask(countyLayer.url+"/0");
var query = new Query();
query.geometry = geometry;
query.spatialRelationship = Query.SPATIAL_REL_TOUCHES;
query.outFields=["*"];
queryTask.on('error', taskErrorHandler);
queryTask.execute(query, findAdjResultHandler);
}
function findAdjResultHandler(results) {
countyList.length = 0;
var fs = results.features;
countyList.push(registry.byId("countySelect").value.toUpperCase());//to get data for the current county too
arrayUtil.forEach(results.features, function(feature){
countyList.push (feature.attributes.COUNTYNAME.toUpperCase());
});
clause = createWhere(countyList);
}
function createWhere(inputArray){//creates a query where clause based on the adjacent county names
var s = "";
arrayUtil.forEach(inputArray, function(item, i){
if (i < inputArray.length - 1){
s = s + '"NAME2" = ' + "'" + inputArray + "'" + ' OR ';
}else {
s = s + '"NAME2" = ' + "'" + inputArray + "'";
}
});
// console.log("where clause is " + s);
return s;
}
function queryAdjacentCounties(){
var currentVis = ncdmLayer.visibleLayers;
var queryTask = new QueryTask(ncdmLayer.url+"/" +currentVis);
var query = new Query();
query.outFields=["NAME", "NAME2", "RATE"];
query.where = clause;
query.returnGeometry = false;
queryTask.on('error', taskErrorHandler);
queryTask.on('complete', queryAdjResultHandler);
queryTask.execute(query);
}