Hello All,I am using the Silverlight API v2.2 and I noticed a rather odd issue.I have some code that will zoom into the extent of the features on the map (usually points and/or polygons). When the function is called again on the same extent, the features within the extent shift north and east a little. Below is the code for the function: private void ZoomIn(List<Graphic> lstGraphics)
{
if (lstGraphics.Count > 0)
{
Envelope zoomExtent = lstGraphics.First().Geometry.Extent;
for (int i = 1, il = lstGraphics.Count; i < il; i++)
{
try
{
zoomExtent = zoomExtent.Union(lstGraphics.Geometry.Extent);
}
catch { continue; }
}
Utils.ApplyWKID(zoomExtent, myCurrentMap.Layers[0].SpatialReference.WKID);
double width = zoomExtent.XMax - zoomExtent.XMin;
double height = zoomExtent.YMax - zoomExtent.YMin;
if (width > 0 && height > 0)
{
//expand by 10%
double newWidth = width + (width * 0.1);
double newHeight = height + (height * 0.1);
double dx = (newWidth - width) / 2;
double dy = (newHeight - height) / 2;
//update extent
zoomExtent.XMin -= dx;
zoomExtent.XMax += dx;
zoomExtent.YMin -= dy;
zoomExtent.YMax += dy;
myCurrentMap.ZoomTo(zoomExtent);
}
else
{
//assume it is a single map point and zoom in
ZoomIn(new MapPoint(zoomExtent.XMin, zoomExtent.YMin, zoomExtent.SpatialReference), LinearUnit.Meter, 1610);
}
}
else
{
ShowMessage("Unable to zoom to map featues. No map features found.");
}
}
I've been able to recreate the behaviour on different basemaps hosted in house and on ESRI's servers. Any help or insight that anyone can provide is greatly appreciated.Thanks In Advance