//find results return an array of findResult. map.graphics.clear(); var dataForGrid = []; //Build an array of attribute information and add each found graphic to the map dojo.forEach(results, function(result) { var graphic = result.feature; dataForGrid.push([result.layerName, result.foundFieldName, result.value]); switch (graphic.geometry.type) { case "point": graphic.setSymbol(markerSymbol); break; case "polyline": graphic.setSymbol(lineSymbol); break; case "polygon": graphic.setSymbol(polygonSymbol); break; } // Get the geometry var pt = graphic.geometry; // Center the map at the point and zoom to scale level 12 map.centerAndZoom(pt,12); map.graphics.add(graphic);
You will probably have to string a couple of functions together, which isn't too hard to do once you know what you are doing.e.g. This example here - http://developers.arcgis.com/en/javascript/samples/find_map/So that's finding a feature and returning the geometry, after that you just need to get that geometry and zoom to it.So in the code, note the bits I've added in //find results return an array of findResult. map.graphics.clear(); var dataForGrid = []; //Build an array of attribute information and add each found graphic to the map dojo.forEach(results, function(result) { var graphic = result.feature; dataForGrid.push([result.layerName, result.foundFieldName, result.value]); switch (graphic.geometry.type) { case "point": graphic.setSymbol(markerSymbol); break; case "polyline": graphic.setSymbol(lineSymbol); break; case "polygon": graphic.setSymbol(polygonSymbol); break; } // Get the geometry var pt = graphic.geometry; // Center the map at the point and zoom to scale level 12 map.centerAndZoom(pt,12); map.graphics.add(graphic);
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.