Select to view content in your preferred language

4.2 goTo collection of graphics with buffer

2811
14
Jump to solution
01-25-2017 09:22 AM
JasonRainwater
Deactivated User

Hi, I have a client side only feature layer that I add graphics to based on external data.  When I use mapView.goTo(featureLayer.source) it properly changes the zoom and panning to bring all graphics into view.  However it does not take into account the sizing of the graphics themselves so while the points are all view some graphics will be cut off out of full view.

Is there a way to goTo a collection of graphics but give it a buffer so that it goes out far enough to ensure the graphics are fully in view?  I can determine the buffer myself but cant find in the documentation how to do this.

Thanks

Tags (2)
0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus

Jason,

   That may have to be a side effect you have to deal with for now. In the 3.x API there was a graphicsUtils class that allowed to to get the extent of the of a FeatureLayers graphics (and thus handled the clientside FL not having a fullextent), but it has not been added to 4.x yet.

0 Kudos
JasonRainwater
Deactivated User

What I don't understand is that the calculations have to be in the sdk somewhere because goTo figures it out and scales/pans to it correct?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Correct it is probably some private internal function of the view or the FeatureLayer.

0 Kudos
thejuskambi
Frequent Contributor

Jason,

Have you tried to get the extent of the featureLayer and then expanding/buffer the geometry by a factor. That way your target geometry will always be bigger then the featureLayer.

-Thejus

JasonRainwater
Deactivated User

I don't see how that works.  its a custom empty feature layer added on the fly.  when I check the fullextent property of the feature layer its null

0 Kudos