Point symbol disappears upon zoom

3904
2
Jump to solution
03-25-2015 04:12 AM
IbrahimHussein
Occasional Contributor

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)

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

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);

              }

            });

View solution in original post

2 Replies
KellyHutchins
Esri Frequent Contributor

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);

              }

            });

View solution in original post

IbrahimHussein
Occasional Contributor

That was it, thanks.

0 Kudos