swingley - I'm guessing it is probably something with my code! Here are a few more lines: function searchRequestID(requestID) {
gmap.closeInfoWindow();
mapExtension.removeFromMap(gOverlays);
gmap.setCenter(new GLatLng(34.8370,-82.3658),12);
//Clear layer definitions
var layerDefinitions = [];
layerDefinitions[0] = "";
layer.setLayerDefinitions(layerDefinitions);
gmap.closeInfoWindow();
var findTask, findParams;
findTask = new esri.arcgis.gmaps.FindTask("my map service url");
findParams = new esri.arcgis.gmaps.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["REQUESTID"];
findParams.searchText = requestID;
findParams.contains = true;
findTask.execute(findParams, zoomToRecord);
mapExtension.removeFromMap(gOverlays);
}
function zoomToRecord(results){
var result, attribs, feature;
if (results == null){
alert("nothing here");
}
if (results.findResults.length >0){
var identifyContent = "Put content here </br>";
var infoWindowOptions = {
content:identifyContent};
var overlayOptions = {
strokeColor:"#FF0000",
strokeWeight:4,
strokeOpacity:0.75,
fillColor:"#FF0000",
fillOpacity:0.0};
gOverlays = mapExtension.addToMap(results, overlayOptions, infoWindowOptions);
for (i=0, il=results.findResults.length; i<il; i++){
result = results.findResults;
feature = result.feature;
attribs = feature.attributes;
if (attribs["Shape"] == "Polygon" || attribs["Shape"] == "Polyline"){
var featureGeometry = result.feature.geometry[0];
var featureBounds = featureGeometry.getBounds();
var zoomLevel = gmap.getBoundsZoomLevel(featureBounds);
var featureCenter = featureBounds.getCenter();
gmap.setCenter(featureCenter, zoomLevel);
}
else if(attribs["Shape"] == "Point"){
var featureGeometry = result.feature.geometry[0];
gmap.setCenter(featureGeometry.getLatLng(), 15);
}
}
if (results.findResults.length > 1){
alert("There are " + results.findResults.length + " locations throughout the city.");
}
}
else if (results.findResults.length == 0){
alert("This project does not have a map location. For a project description, click on the information button in the table.");
}
}
As part of my troubleshooting, I added a line in there that checks if any results are returned and alerts me if nothing is found. It's not returning any results...I get the "nothing here" message. I have attached a screenshot that shows that I get results when running the find task from REST. I see that it has a FeatureID of -1. Would that cause a problem?Thank you for your help!