symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]), 5), new Color([255, 255, 0, 0.25]) ); psymbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CIRCLE, 8, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]), 8), new Color([255, 255, 0, 0.25]) ); function featureZoom(feature) { map.graphics.clear(); ftype = feature.geometry.type; //console.log(feature); if(ftype == "point") { var pt = feature.geometry; var factor = 1; //some factor for converting point to extent var extent = new esri.geometry.Extent(pt.x - factor, pt.y - factor, pt.x + factor, pt.y + factor, pt.spatialReference); map.setExtent(extent.expand(60)); // change this control the zoom showFeature(feature); } else { var fExtent = feature.geometry.getExtent().expand(3); map.setExtent(fExtent); showFeature(feature); } } function showFeature (feature) { map.graphics.clear(); ftype = feature.geometry.type; if(ftype == "point") { feature.setSymbol(psymbol) setTimeout(function(){map.graphics.clear()}, 3000); } else { feature.setSymbol(symbol); setTimeout(function(){map.graphics.clear()}, 3000); } map.graphics.add(feature); }
/***** this would be in your function to create the infowindow ****/ // "results" would be the response from your query StFeatures = results.features; StResults = {displayFieldName: null, features:[]}; for (var i = 0; i < scount; i++) { var sResult = StFeatures; //alert(sResult); if (!StResults.displayFieldName){ StResults.displayFieldName = sResult.displayFieldName } StResults.features.push(sResult); } var stlist = streetList(StResults); // create list to populate the div $("#stlist").html(stlist); //jQuery to fill div with id stlist with the table... can use arcgis function for this also $("#stlist").show("slow"); //jQUery to show the datagrid which is hidden by default /******* End ******/ function streetList(results) { var template = ""; var sn = results.features; template = "<i>Streets Found: " + sn.length + "</i>"; template += "<table border='1'>"; template += "<tr>" template += "</tr>"; for (var i = 0, il = sn.length; i < il; i++) { template += "<tr>"; template += "<td>"+ sn.attributes["FULLADDRESS"] +"</td>"; template += '<td><a href="#" onclick="featureZoom(StResults.features['+ i +']); return false;">(Zoom To)</a></td>'; template += "</tr>"; } template += "</table>"; return template; } function showFeature (feature) { map.graphics.clear(); ftype = feature.geometry.type; if(ftype == "point") { feature.setSymbol(psymbol) setTimeout(function(){map.graphics.clear()}, 3000); } else { feature.setSymbol(symbol); setTimeout(function(){map.graphics.clear()}, 3000); } map.graphics.add(feature); } function featureZoom(feature) { map.graphics.clear(); ftype = feature.geometry.type; //console.log(result); if(ftype == "point") { var pt = feature.geometry; var factor = 1; //some factor for converting point to extent var extent = new esri.geometry.Extent(pt.x - factor, pt.y - factor, pt.x + factor, pt.y + factor, pt.spatialReference); map.setExtent(extent.expand(60)); showFeature(feature); } else { var fExtent = feature.geometry.getExtent().expand(3); map.setExtent(fExtent); showFeature(feature); } }
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.