Zoom to extent where feature is visible?

1783
5
05-25-2016 06:56 AM
Hernando_CountyProperty_Apprai
New Contributor III

I have map where I am zooming to a parcel.  The parcel layer is part of a service so I load all the layers in the service as a ArcGISDynamicMapServiceLayer layer.  I also load a point feature from another service as a FeatureLayer.  When I zoom to a parcel, I then want to zoom out until I can see at least one feature from the FeatureLayer.  Is this possible, and if so can anyone give me guidance as to how to easily accomplish this?  Any help would be greatly appreciated.

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Priscilla,

  Are you saying that you need to determine (in the code) how far to zoom out until you have at least one of the other features in your maps extent?

0 Kudos
Hernando_CountyProperty_Apprai
New Contributor III

Yes Robert.  That's exactly what I'm saying.  When some enters a parcel key I zoom to it.  But really what I want to do is set the extent so that the nearest point to that parcel polygon, along with the polygon itself, is displayed.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Priscilla,

OK that would involve zooming to the parcel and then doing a spatial query to see if a feature from the other layer intersects the maps extent and if not zoom out again and repeat the process until you get a successful result of the intersects query. Is the other feature part of the same map service or is it possibly added as a FeatureLayer?

Hernando_CountyProperty_Apprai
New Contributor III

The other feature is not part of the same map service but is added as a featurelayer.  I had also thought about doing a spatial query with a buffer but then I found something about FindNearest which uses the spatial analyst service.  However, I don't want to use ESRI's spatial analyst service.  I want to build my own but I'm not sure how to do that.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Priscilla,

  Does the app or the data happen to be public?

0 Kudos