I try to identify a parcel and return results on the same infowindow but missing a "Zoom to" link and can't figure out how to highlight a parcel only.
I put the code here:
Edit fiddle - JSFiddle
Hope someone can show me what I am missing...
Thanks.
for some reason formatting was completely off in my previous post.
function showIdentifyResults(r, tasks) { var results = []; var taskUrls = []; r = dojo.filter(r, function (result) { return r[0]; }); for (i = 0; i < r.length; i++) { results = results.concat(r); for (j = 0; j < r.length; j++) { taskUrls = taskUrls.concat(tasks.url); } } //combine content ------------------- var content = parcels = buildings =""; var parcelFeatures = []; dojo.forEach(results, function(result) { var feature = result.feature; var atts = feature.attributes; feature.attributes.layerName = result.layerName; if(result.layerName === 'Tax Parcels'){ parcels += atts["Postal Address"] + "<br />"; parcelFeatures[parcelFeatures.length] = result.feature; } else if (result.layerName === 'Building Footprints'){ buildings += "Building/Parcel ID: " + atts.PARCELID + "<br />"; } }); if ( parcels ) { content += "<b>Parcels</b><br />" + parcels; } if ( buildings ) { content += "<b>Buildings</b><br />" + buildings; } console.log("content: ", content); map.infoWindow.setTitle("Parcel Information"); map.infoWindow.setContent(content); //map.infoWindow.show(idPoint); if (results.length === 0) { map.infoWindow.clearFeatures(); } else { map.infoWindow.setFeatures(parcelFeatures); map.infoWindow.setContent(content); } map.infoWindow.show(idPoint); return results; }
May Jeff,
You will not get the zoom to or feature highlight without setting the infoWindows.setFeatures method. More like this sample: Display identify results in popup | ArcGIS API for JavaScript
if I set the infoWindows like this -
map.infoWindow.setFeatures(results);
Nothing shows up anymore. Can you show me on the JSFiddle? Thanks.
This gets you closer, but it also returns the layers you haven't supplied content for.
Here is a fiddle that only does the parcels (i think the way you want).
JSFiddle Link
Thanks for your sample. Eventhough I define the layerName I want, but it still shows up all layers. Can you show me how to exclusive some layer names?
Actually I try to identify multiple map services with certain layer names with their attributes to show up in ONE page infoWindow and then only highlight parcel polygon.
I only find out I can use content to do it but won't highlight any result at all based on the Robert mentioned above - NEED map.infoWindow.setFeatures(results). I used the sample you all shows on JSFiddle, I can't show all attributes information in one page. What do I need to modify it so can show all results in one page?
Thank you for your time.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.