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 null
Does 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.
From the error message, I think the problem lies in the queryExtent in your executeQueryTask(evt) function. Try this to see if it works:
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);
}