Its Showing the google map and on screen the area is showing, but not showing data for my Tab file. Is the above method is right or wrong? Please suggest.
Thank you for your post, your sample code looks like everything is OK, the problem maybe is caused by wrong style, does the tab file all contains point? Could you please try to add linestyle and areastyle and have an other try?
Actually the tab file is based on point based style and it is working with map control, but it is not showing on google map. I have also added all style as you have suggest, but result is same.
Dim
customLineStyle As Style = New LineStyle(New GeoPen(GeoColor.SimpleColors.Black, 1))
Dim customAreaStyle As Style = New AreaStyle(New GeoPen(GeoColor.SimpleColors.Black, 1))
Dim customPointStyle As Style = New PointStyle(PointSymbolType.Star, New GeoSolidBrush(GeoColor.SimpleColors.LightGreen), 10)
Now it is working, but I am getting some other logical issue, that why earlier it was not working. I am briefing here-
1) First I have taken googlemaplayer and added on WinformsMap1.Overlays.Add(googleMapLayer) 2) Now I open tab file and try to adding TabFeatureLayer:- I am trying to add like a) Dim staticOverlay As LayerOverlay = New LayerOverlay() staticOverlay.Layers.Add(“WorldLayer”, layer) 'layer is tabfeaturelayer WinformsMap1.Overlays.Add(staticOverlay)
Its showing map on googleoverlay b) WinformsMap1.Overlays(0).Lock.EnterWriteLock() Try DirectCast(WinformsMap1.Overlays(0), LayerOverlay).Layers.Add(layerName, layer) Finally WinformsMap1.Overlays(0).Lock.ExitWriteLock() End Try
Its not working.
Is there any difference in method a and method b? Because in both method I have written LayerOverlay then why not it is working with second method.
I need to resolve first method into second one, because second method is applyed in my whole application. Please suggest.
here layername is name of layer and layer is TabFutureLayer, also there are many activity doing with application and when required I am able to add,remove and find the layer with help of Directcast. It all working for me.
Now I want to add a feature of googlemap for this I added a button to set the google map layer with following code WinformsMap1.MapUnit = GeographyUnit.Meter Dim googleMapLayer As GoogleMapsOverlay = New GoogleMapsOverlay() WinformsMap1.Overlays.Add(googleMapLayer)
and at times of Tab file loading I am checking is it google map or not, if it is google map I am setting the projection
Dim proj4 As Proj4Projection = New Proj4Projection() proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326) proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString() layer.FeatureSource.Projection = proj4
and at last the same way try to add layer on google map. My google map is viewing but not the tab file.
Now I want to work with same application with googlemap layer, so that I tried to add DirectCast(WinformsMap1.Overlays(0), LayerOverlay).Layers.Add(layerName, layer) for the same. so, 1) As I mention on form load I have added LayerOverlay in WinformsMap1.Overlay, so it should be LayerOverlay. 2) If WinformsMap1.Overlays(0) is background overlay, how and what we should change in the statement, so that it works in both case as LayerOverlay.
You said it is not working correctly, according to my tests I cannot reproduce your problem exactly, can you arrange a simple sample to us so that we can fix your problem exactly?
Thank you for your sample code, with it, we can find the root cause.
The problem is map overlay draw order. You have added the LayerOverlay at the beginning, then add the GoogleOverlay, that will let the LayerOverlay draw first, GoogleOverlay after it.
There are two solutions to resolved it:
1. Don’t use the LayerOverlay you have added. try to add new LayerOverlay every time you add tabFeatureLayer.
LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add(“WorldLayer”, worldLayer); winformsMap1.Overlays.Add(staticOverlay);
2. Use the first LayerOverlay but move the GoogleOverlay to the bottom to make sure draw it first.
WinformsMap1.Overlays.MoveDown(1)
but please notice change your code WinformsMap1.Overlays(0) to WinformsMap1.Overlays(“layerOverlay”) to get your layerOverlay, otherwise it will throw exception.
Any more questions please feel free to let us know.
Before you get a more detailed answer from your support guy, let me tell you what I think the problem is by reading your descriptions. I think that you have a projection issue. I think that your tab file is in another projection which means that it is not going to show up in line with GoogleMap. I hope that I gave you some directions about what could be the problem in your case before you get some more specific help from Gary. Thank you.
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.
We would need to see your tab file. It is difficult to see what is happening with only your code without being able to run it. You can attach your tab file to this post or, if you feel more confortable, you can send it to support@thinkgeo.com. We are waiting for your response. Thank you.
Dear Val, Sorry for delay, because I was out of station. So sorry once again.
I have sended my zipped file on support@thinkgeo.com. In the zipped file there was code as well as four tab file and the status of all tab file is like below
1) 0201_01.tab - this file is working properly in both mode. In Normal as well as google.
2) AZX0325_1.tab - this file is working in Normal mode, although you will not see on screen, but when you click in full extent button, it will show on screen. But it will not show on google map.
3) Dasa0325_01.tab - the exception coming and message is "Read and write not equal". This message is coming in both mode. What is the meaning?
4) bulend010.tab - this file is working in Normal mode, although you will not see on screen, but when you click in full extent button, it will show on screen. But when you try to open this file on google map, it gives exception "Parameter is not valid"
Please check the tab file and advice me the best way to deal with this.
Can I upload my zipped file with my ticket with 3370 / 4270?
Because I got mail from supports, they are not able to download, because my files showing virus. I check my files with Micosoft Security Essentials and its not showing any threat. I also try to upload files with FTP, but I think there is some permission issue. So, if I can send this file with my ticket.
Using FTP is our prefered way to receive files. Please, follow exactly the instructions that were sent to you for using our FTP and you should not have any problem. Thank you.