ThinkGeo.com    |     Documentation    |     Premium Support

Special characters in column names

When trying to read Mapinfo TAB vector files I couldn't access any of the columnvalues. I figured out that this was because some of the columnnames started with an underscore ( _ ), and the problem is not unique to Mapinfo TAB files.


It would be nice if this could be solved (or at the very least, documented).


Throwing an error and refusing to load such a file might be a less desirable option, as the geodata is shown properly, which is worth something in itself, it could be enough under certain circumstances.



Wouter,


I create a very simple tab data with underscore (_) in its column value, and it seems works fine. Please try it.
 
Attachment contains the data which contains 2 point records, both of them with underscore in its column values.
 
Following is the code to load it into MapSuite:

       winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
                winformsMap1.ThreadingMode = MapThreadingMode.SingleThreaded;

                winformsMap1.CurrentExtent = new RectangleShape(-96.51477, 30.759543, -94.355788, 28.910652);
                winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

                TabFileFeatureLayer worldLayer = new TabFileFeatureLayer(@"C:\temp\tab_underline\result.TAB", "FID", "OGRSchema", "result", "GEOMETRY");
                worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), GeoColor.SimpleColors.Green);
                worldLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1;
                worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                LayerOverlay staticOverlay = new LayerOverlay();
                staticOverlay.Layers.Add("WorldLayer", worldLayer); 
                winformsMap1.Overlays.Add(staticOverlay);

                winformsMap1.CurrentExtent = new RectangleShape(40, 80, 80, 40);

                winformsMap1.Refresh();

 
Following codes shows returning features based on query:

       worldLayer.Open();
                Collection<Feature> allFeatures = worldLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);
                worldLayer.Close();

                worldLayer.Open();
                Collection<Feature> boundingBoxFeatures = worldLayer.QueryTools.GetFeaturesInsideBoundingBox(winformsMap1.CurrentExtent, ReturningColumnsType.AllColumns);
                worldLayer.Close();

              
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

1359-tab_underline.zip (809 Bytes)

YAle, 
  
 I’ve the same issue. 
 shapes created by arcview starts with “_” in column NAME and not in column value. 
  
 Please let us know what is the solution 
  
 Patrick.

Patrick & Wouter, 
  
 Thanks for your post. 
  
 It is a bug when the column name starts with “_” instead of column value. I have added it to our working track system and hopefully it can be solved very soon. 
  
 Please respond back to this post to keep it alive so we can keep an eye on it. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale