Hi, when I add a shapefilelayer, I also want to zoom to the extent of the layer. This code below works everywhere else apart from the dateline where it just zooms out to the wold map. Looks like it is not zooming correctly to the extent when the shapefile crosses over the dateline. My code is given below and specific lines that are used to zoom are highlighed in yellow. Please help.
public void AddCustomFeatureLayer(WpfMap wpfMap1, string location,string LayerName)
{
ShapeFileFeatureLayer customLayer = new ShapeFileFeatureLayer(@location);
customLayer.RequireIndex = false;
customLayer.Open();
ThinkGeo.MapSuite.Core.RectangleShape rect = customLayer.GetBoundingBox(); //get the extent of the current layer
if (customLayer.UsingSpatialIndex == false)
{
customLayer.Close();
ShapeFileFeatureSource.BuildIndexFile(@location, BuildIndexMode.Rebuild);
}
customLayer.RequireIndex = true;
Proj4Projection proj4 = new Proj4Projection();
string prjFileText = System.IO.File.ReadAllText(@location.Replace("shp", "prj")); //get the text of the .prj file.
proj4.InternalProjectionParametersString = Proj4Projection.ConvertPrjToProj4(prjFileText); //set
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); /
customLayer.FeatureSource.Projection = proj4; // proj_EEZs;
customLayer.WrappingMode = WrappingMode.WrapDateline;
customLayer.WrappingExtent = new RectangleShape(WrapExtentMinX, WrapExtentMaxY, WrapExtentMaxX, WrapExtentMinY); //new RectangleShape(17897271, -1367305, 19514067, -2411741);
customLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
customLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Name = LayerName;
staticOverlay.Layers.Add(LayerName, customLayer);
staticOverlay.Layers.MoveToTop(LayerName);
wpfMap1.Overlays.Add(staticOverlay);
wpfMap1.CurrentExtent = rect;
wpfMap1.Refresh();
}