Dear Val,
Thank you for reply,
Actually, when I am loading my tab file, following code is written
Private Sub AddTabFeatureLayers(ByVal fileNames As IEnumerable(Of String))
For Each fileName As String In fileNames
Try
Dim layerName As String = System.IO.Path.GetFileNameWithoutExtension(fileName)
If Not DirectCast(WinformsMap1.Overlays(“layerOverlay”), LayerOverlay).Layers.Contains(layerName) Then
Dim layer As TabFeatureLayer = New TabFeatureLayer(fileName, TabFileReadWriteMode.ReadWrite)
layer.Name = layerName
ExplorerHelper.SetStyleByWellKnownType(layer)
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
'layer.RequireIndex = False
TabFeatureLayer.BuildIndexFile(fileName)
'----------------
Dim boundingBox As RectangleShape = Nothing
Process.GetCurrentProcess().ProcessorAffinity = CType(1, System.IntPtr)
If layer.HasBoundingBox Then
If Not layer.IsOpen Then
layer.Open()
'Dim b As Boolean = layer.FeatureSource.CanExecuteSqlQuery
'Dim dt As DataTable = layer.FeatureSource.ExecuteQuery("Select * from " & layerName)
End If
If boundingBox Is Nothing Then
boundingBox = layer.GetBoundingBox()
Else
boundingBox.ExpandToInclude(layer.GetBoundingBox())
End If
layer.Close()
End If
Dim boxArea As String = boundingBox.ToString
Dim bArea() As String = Split(boxArea, “,”)
Dim xLatCor As Double
Dim yLongCor As Double
If CDbl(bArea(0)) <> 0 Then
xLatCor = CDbl(bArea(0))
If xLatCor < 0 Then
xLatCor = CDbl(bArea(2))
End If
Else
xLatCor = CDbl(bArea(2))
End If
If CDbl(bArea(1)) <> 0 Then
yLongCor = CDbl(bArea(1))
If yLongCor < 0 Then
yLongCor = CDbl(bArea(3))
End If
Else
yLongCor = CDbl(bArea(3))
End If
If Math.Abs(xLatCor) > -180 And Math.Abs(xLatCor) < 180 Then
'This is decimal degree map
If G_GoogleLayerSelected = True Then
Dim proj4 As Proj4Projection = New Proj4Projection()
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326)
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString()
layer.FeatureSource.Projection = proj4
End If
Else
'This is meter map
Dim proj4 As ManagedProj4Projection = New ManagedProj4Projection
proj4.InternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(32643)
proj4.ExternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(4326)
layer.FeatureSource.Projection = proj4
End If
layer.DrawingQuality = DrawingQuality.CanvasSettings
WinformsMap1.Overlays(“layerOverlay”).Lock.EnterWriteLock()
Try
DirectCast(WinformsMap1.Overlays(“layerOverlay”), LayerOverlay).Layers.Add(layerName, layer)
Finally
WinformsMap1.Overlays(“layerOverlay”).Lock.ExitWriteLock()
End Try
SetupThemeItem(layer)
addedFiles.Add(fileName)
WinformsMap1.CenterAt(New PointShape(xLatCor, yLongCor))
End If
Catch fle As FileLoadException
RemoveFeaturefile(DirectCast(fle.InnerException, FileNotFoundException))
Catch ex As Exception
MessageBox.Show(ex.Message, ex.[GetType]().ToString(), MessageBoxButtons.OK, MessageBoxIcon.[Error], MessageBoxDefaultButton.Button1, DirectCast(0, MessageBoxOptions))
End Try
Next
End Sub
In my point of view, my all .TAB file is decimal degree. So, please give some more help.
Regards
Sanjay