//remove all graphics on the maps graphics layer map.graphics.clear(); var extent = esri.graphicsExtent(featureSet.features); map.setExtent(extent.expand(1), true);
I have a filter by points working so when a user types something into a text box and hits a button it queries the map and zooms them to the queried results. This works fine for multiple points but is not working when the result is just a single point. Below is my code. Thanks in advance!//remove all graphics on the maps graphics layer map.graphics.clear(); var extent = esri.graphicsExtent(featureSet.features); map.setExtent(extent.expand(1), true);
var newExtent = new esri.geometry.Extent(); newExtent.xmin = YourSinglePointX - 100; newExtent.ymin = YourSinglePointY - 100; newExtent.xmax = YourSinglePointX + 100; newExtent.ymax = YourSinglePointY + 100; newExtent.spatialReference = map.spatialReference; map.setExtent(newExtent);
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.