Select to view content in your preferred language

How to zoom to points?

400
1
08-02-2012 05:04 PM
JoshPorter
Occasional Contributor
What is the best way to zoom to a group of points and also a single point?  I have this code, but it doesnt always seem to work when there is only 1 point in the list.  Any tips?


Dim inclusiveExtent As New ESRI.ArcGIS.Client.Geometry.Envelope With {.SpatialReference = esriMap.SpatialReference}
Dim  mp As ESRI.ArcGIS.Client.Geometry.MapPoint
        For Each pt As Point In pPoints
            mp = mercator.FromGeographic(New ESRI.ArcGIS.Client.Geometry.MapPoint(pt.X, pt.Y))
            inclusiveExtent = inclusiveExtent.Union(mp.Extent)
            'esriMap.ZoomToResolution(esriMap.Resolution )
        Next
        esriMap.ZoomTo(inclusiveExtent)

0 Kudos
1 Reply
DmitriiIgnatiev
Occasional Contributor
For me the answer is to check the extent of the group of objects you have to zoom to. If this extent is too small or has a zero size you might want to create a kind of rectangle around an object of interest and zoom to it. I usually have a so called "zoom tolerance" setting defining a linear size of a point :)))
0 Kudos