[ATTACH=CONFIG]11168[/ATTACH][ATTACH=CONFIG]11169[/ATTACH]Thanks for your help.This is inside my init function:dojo.connect(map, 'onLoad', function (theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('mapDiv'), 'resize', map, map.resize);
var maxOffset = function maxOffset(map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
};
});
This is a function that I use to query my feature and then add the graphic(s) to the map:function zoomToEFH_Feature(name) {
//set up maxOffset for performance
var maxOffset = function maxOffset(map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
};
//create feature layer
var efhLayer = new esri.layers.FeatureLayer("http://<internal server>/ArcGIS/rest/services/NMFS/EFH_MapperData/MapServer/6", {
maxAllowableOffset: maxOffset(map, 1),
outFields: ["*"],
opacity: 0.75,
id: "efhL"
});
efhLayer.setDefinitionExpression("TYPE='EFH'");
//initialize query
EFH_Fquery = new esri.tasks.Query();
EFH_Fquery.where = "DDBOX = '" + name + "' AND FMC = '" + regionName + "'";
//console.log(EFH_Fquery.where);
//execute query
efhLayer.queryFeatures(EFH_Fquery, function showResults(featureSet) {
//console.log('inside show Results for EFH query');
map.graphics.clear();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID).setColor(new dojo.Color([255, 255, 0, 0.5]));
//console.log(featureSet.features.length);
var legendcode = '<table border=0 cellspacing="5" cellpadding="5"><caption>Lifestages</caption>';
//Loop through features in the featureSet and add them to the map.
for (var i = 0, il = featureSet.features.length; i < il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = featureSet.features;
graphic.setSymbol(symbol);
var featureextent = graphic.geometry.getExtent();
map.setExtent(featureextent, true);
//Add graphic to the map graphics layer.
map.graphics.add(graphic); })
}