The TabFeatureLayer I try to use commits correctly points and I can see them once I open the tab file in any popular GIS. However when I try to commit LineShapes (in a different tab) it fails to CommitTransaction with an InvalidOperationException after a few additions/iterations. The specific message I get is "The shape you provided does not pass our simple validation.The shape you provided does not pass our simple validation."
I was hoping that my line shape had an issue but it is just a simple line with 3 vertices. Moreover, if say that exception occurs at the 36th iteration and I force this particular lineshape to be the first feature to be inserted into my tab file, it works fine till it fails for another lineshape. That means, I think, that there is nothing wrong with my lineshape rather with the status of the tabfeaturelayer. Finally once a lineshape fails, then all of the rest will fail with same exception even if I do a RollbackTransaction. Any help will be much appreciated.
2. The isValid() test on that feature before I Add it and commit it in the tab layer is successful.
Also here is the way the TabFile is created:
TabFeatureLayer.CreateTabFile(<fileName path>, PLine.GetDBColumns, New List(Of Feature))
As I have no features yet I create an empty list of Features. Then I open the tab file using:
Dim plinesTab As New TabFeatureLayer(<fileName path>, TabFileReadWriteMode.ReadWrite) plinesTab.RequireIndex = False
To populate my tab file is use:
plinesTab.Open() plinesTab.EditTools().BeginTransaction() Try Dim aTripFeature = PLine.GetFeature(aTrip, tripID) If Not aTripFeature.IsValid() Then Console.WriteLine("That was not valid") End If plinesTab.EditTools().Add(aTripFeature) plinesTab.EditTools().CommitTransaction() Catch ex As InvalidOperationException plinesTab.EditTools().RollbackTransaction()
End Try plinesTab.Close()
Please note that my features are always VALID and it is strange that although the if is never trigered, it fails when CommitTransaction with error related to invalid feature. The PLine.GetDBColumns function is as follows: Public Shared Function GetDBColumns() As IEnumerable(Of ThinkGeo.MapSuite.Core.DbfColumn) Dim plinesColumns As New List(Of TabDbfColumn) plinesColumns.Add(New TabDbfColumn("TrackID", DbfColumnType.String, 50, 0, True, True)) Return plinesColumns End Function Thanks again
As I was under pressure to solve this issue I had to improvise. So I bypassed the MapSuite TabLayer API and used the MITAB library (mitab.maptools.org/). All my features were correctly exported and saved in a TAB file which makes me believe the issue lays with the TabLayer api of MapSuite rather than my features. Since this is unmanaged code I would like to go back to MapSuite.
Looking forward for a solution Kind Regards Yiannis
Are there any news on this front at all? Today I tried again to use the TabFeatureLayer again and I also found that it does not support Tabfiles that have no geometries. Every other GIS is happy to open Data only/textual tab files that have only the .DAT and .TAB files present. I will have to revert again to the MiTab library but any help towards this front will be greatly appreciated.
one final request, I might be wrong but mapsuit TAB files implementation also seems not to support cutom indexes like Shp files do but only the default spatial index (the .idx file). If this is the case, are you planning to provide soon any extended Tab file support to cover for these issues?
the question is related with the topic here on shp file searching and indexing. So when we have shape files we can do this:
ShapeFileFeatureLayer.BuildIndexFile("C:\\Users\\janagn.ANATEC\\Desktop\\Emissions Files for Ioannis\\Hormuz Data\\Oman aisData Points.shp", "C:\\Users\\janagn.ANATEC\\Desktop\\Emissions Files for Ioannis\\Hormuz Data\\Points_TrackID.idx", "TrackID", "", BuildIndexMode.DoNotRebuild); mshpLayer = new ShapeFileFeatureLayer("C:\\Users\\janagn.ANATEC\\Desktop\\Emissions Files for Ioannis\\Hormuz Data\\Oman aisData Points.shp","C:\\Users\\janagn.ANATEC\\Desktop\\Emissions Files for Ioannis\\Hormuz Data\\Points_TrackID.idx", ShapeFileReadWriteMode.ReadOnly);
While in tab file we can only build index without defining the columns etc. So how do you go about and index on a particular column in tab files and further more, how do you apply on a tab file the solution you provided on here
Sorry for waiting, we are working on this and try to enhancement our TabFeatureSource to improve it’s own GetFeaturesByColumnValueCore function, I will let you know the result as soon as possible.