Hey guys,
I am working on an app where a user clicks on a piece of data in a grid which then zooms to the location. Since these are points, I could use setextent, and used centerAndZoom to zoom to the point. My issue though here is when it zooms to the point, the point symbol disappears. is there anyway to keep the point symbol upon executing centerAndZoom()?
heres a fiddle Edit fiddle - JSFiddle
ok what I did was make the point into a graphic. doesnt keep the same symbol, which really isnt a problem.
if anyone were to have the same issue-
markersymbol = make a new symbol
var graphic = your point
graphic.setsymbol(markersymbol)
map.graphics.add(graphic)
Solved! Go to Solution.
If I understand the issue correctly you have a few options. One option would be to define a selection symbol for the feature layer. Another option is just to switch to queryFeatures and it'll use the same symbol it just won't be selected. Here's the code you'd need to switch out for your code that currently uses fl.selectFeatures
fl.queryFeatures(query, function(result) { var features = result.features; if ( features.length ) { map.centerAndZoom(features[0].geometry,18); console.log(features[0].toJson()); } else { console.log("Feature Layer query returned no features... ", result); } });
If I understand the issue correctly you have a few options. One option would be to define a selection symbol for the feature layer. Another option is just to switch to queryFeatures and it'll use the same symbol it just won't be selected. Here's the code you'd need to switch out for your code that currently uses fl.selectFeatures
fl.queryFeatures(query, function(result) { var features = result.features; if ( features.length ) { map.centerAndZoom(features[0].geometry,18); console.log(features[0].toJson()); } else { console.log("Feature Layer query returned no features... ", result); } });
That was it, thanks.