I tried- function showResults(featureSet)//Zoom to the extent of the graphicsquery.where = ""; var centerPoint = evt.mapPoint; var mapWidth = theMap.extent.getWidth(); var pixelWidth = mapWidth/theMap.width; //Calculate a 10 pixel envelope width (5 pixel tolerance on each side) var tolerance = 5 * pixelWidth; var queryExtent = new esri.geometry.Extent(centerPoint.x -tolerance, centerPoint.y -tolerance, centerPoint.x +tolerance, centerPoint.y +tolerance, theMap.spatialReference); query.geometry = queryExtent;var ResultEnv = query.geometry.getExtent().expand(10.0);theMap.setExtent(ResultEnv);but I get an error: ReferenceError: evt is not defined
var ResultEnv =esri.graphicsExtent(featureSet.features); theMap.setExtent(ResultEnv);
Thanks for taking a look at it, unfortunately I still get the same error. Could the issue also be in- var ResultEnv = query.geometry.getExtent().expand(10.0);??
I'm trying to use the code sample here to use URL parameters to select one or more POINT features and zoom the map to those features. I have configured it using one of my polygon features and it works but I'm trying to use it for a point feature.When I try passing this URL parameter the symbol appears around the point but the map does not zoom in or display the points information. Also I get this error- TypeError: query.geometry is nullDoes anyone know what I need to add to my code to allow this to work properly? I've tried a few different ways but not having much luck.
function executeQueryTask(evt) { query.where = ""; var centerPoint = evt.mapPoint; var mapWidth = theMap.extent.getWidth(); var pixelWidth = mapWidth/theMap.width; //Calculate a 10 pixel envelope width (5 pixel tolerance on each side) var tolerance = 5 * pixelWidth; var queryExtent = new esri.geometry.Extent(centerPoint.x -tolerance, centerPoint.y -tolerance, centerPoint.x +tolerance, centerPoint.y +tolerance, theMap.spatialReference); query.geometry = queryExtent; queryTask.execute(query, showResults); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.