displaying infotemplate on query

647
3
03-19-2018 01:28 PM
peterokello
New Contributor

how can i display an infotemplate while zooming to a point on a map after doing a query on a feature layer using a result stored in local storage

var terminal= localStorage.getItem('terminal');
var info= new InfoTemplate({title:"Name"});
var queryTask = new QueryTask("https://services1.arcgis.com/Kw7jGaBPiN3WUAmT/ArcGIS/rest/services/ID_Terminals1a/FeatureServer/0",{mode:FeatureLayer.MODE_ONDEMAND,
infoTemplate:info,
outFields:["Name"]
});

var query = new Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.where = "Name = '" + terminal + "'";
queryTask.execute(query, showResults);

function showResults(results) {
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
//Zoom to line extent
var geom = results.features.geometry;
//geom.setInfoTemplate(info);
//Zoom to line extent

map.centerAndZoom(geom, 19);


}
}

the query zooms to the point fetched from the local storage but does not display the infotemplate

0 Kudos
3 Replies
TamaraGrant1
Occasional Contributor III

Hello,

Thank you for your question. I think this would be best asked in one of the developer spaces on GeoNet- https://community.esri.com/community/developers Please choose the space that best fits the application and/or programming language you are using.

Sincerely,
Tamara

0 Kudos
TamaraGrant1
Occasional Contributor III

Please disregard my last comment, I see that you've already asked it in that location. 

Sincerely,
Tamara

by Anonymous User
Not applicable

Hi Peter, Checking in. Were you able to resolve this problem?

0 Kudos