ThinkGeo.com    |     Documentation    |     Premium Support

Problem to Load TabFile

I can easily load the Polygons' Tabfile, but I have problem in loading Point and Polyline Tabfiles.


My Code is:




wpfMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent);
wpfMap1.MapUnit = GeographyUnit.DecimalDegree;

TabFileFeatureLayer worldLayer = new TabFileFeatureLayer(Addreess, null);

worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.NoData1;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

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

worldLayer.Open();
wpfMap1.CurrentExtent = worldLayer.GetBoundingBox();
worldLayer.Close();

wpfMap1.Refresh();


I changed the MapUnit to Meter and  Feet , but it did not have any effect.


 


In addition, we use the shapeFileLayer.GetShapeFileType() to find the type of Shape File, is there any method to find the TabFile's Type?



The first thing I would make sure is that you are using the right symbol accroding to the layer type (point, line or polygon). See the code below. Tommorow, the development team will give you a more exact answer on your question if you can get programatically the type of the TabFile.


 



            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.StandardColors.Red, 12);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            lineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Red, 2, true);
            lineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


Ben, 
  
 Have you tried Val’s code? If it still doesn’t work, could you please send us your data so we can have a try here, you can send it to support@thinkgeo.com and ask to forward to Ben. 
  
 For TabFile, we don’t have a method to get the ShapeType directly, you need to Get a Feature (ex: tabFileFeatureLayer.QueryTools.GetAllFeatures()) from the TabFile and call feature.GetWellKnownType() to get the type. That will take a while though and I suggest you to try Val’s codes: set the style for Point, Line and Polygon at the same time if you are not sure what type is for the TabFile.   
  
 Thanks, 
  
 Bai  


Great, It works perfectly.


 



That’s awesome!

As you said above you have not support a method to return type of tab file, and we need to read a feature to find a type of tab file. 
 my Question is:  
 what’s the fastest way to find a feature of a tab file? 

Ben, 
  
 For now, we do not have an API for feature type querying. The only way I can imagine to query the type of the feature is to get all features first and then get the type info out of them. It’s a very inefficient way, and this issue has been added to the working schedule of our development team.  
  
 Sorry for the inconvenience. 
  
 Thank, 
  
 James

I think that you always add FID column to the Fdo Files, am I right? 
  
 if I am, we can search for value 1 in FID column and then find the type of file base on found feature. 
  
 Thanks

Hi Ben, 
  
 I thought FID column is not always in a FDO but you are right, it is always added, so you can use GetFeatureById("1") to get the first feature and then get its type. Thanks for the info! 
  
 Thanks, 
  
 James