Set correct scale when zooming to a graphic that is on the graphics layer

753
4
11-22-2017 11:00 AM
EvonFranklin
New Contributor III

When I add a graphic to the layer and use the zoomTo feature the scope seems to cut off some of the feature within the "MAP" DIV element. Its currently set to 70% of the screen height via CSS and it is kind of puzzling whether this is natural behaviour or its my code I used for styling the page. Can anyone advise me as to if this is natural ?

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Evon,

   Are you talking about 3.x or 4.x? What type of layer are you adding a graphic to?

0 Kudos
EvonFranklin
New Contributor III

In 4.5 and MapImageLayer

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Evon,

  It is likely your code. Can you share a sample that demonstrates this behavior?

0 Kudos
HezronPhilip
New Contributor II

Hi,

Sometimes based on the aspect ratio of your monitor the zoom extent might sometimes cut off features (I say this because I've noticed this happening in my widescreen display, while the features load right in a different display). I suggest you use graphicUtils to get the extent of your graphic/graphics and then set that extent to the map. (using the expand property might ensure that all the features are visible on your map.)

//sample

var Extent = graphicsUtils.graphicsExtent([graphic1, graphic2]);
map.setExtent(Extent .expand(3));

0 Kudos