Hi,
We are writing some proof of concept code at the moment to export some data into Tab files, and it looks like there's a problem when creating the file with multi polygons. I've included two snippets below. The first (CreateTabFileWorking) works and has also been tested with a Polygon (haven't tested other types). The second (CreateTabFileNotWorking) fails.
Any pointers? Or have we uncovered a bug? This was tested in both version 5.5 and 6.0.
public void CreateTabFileNotWorking()
{
var columns = CreateColumnDefinitions();
var notWorkingGeom = new MultipolygonShape("MULTIPOLYGON (((143.1844220161438 -9.0485219955444336, 143.18442094326019 -9.03185498714447, 143.16775500774384 -9.03185498714447, 143.15109002590179 -9.0318540334701538, 143.13442301750183 -9.0318540334701538, 143.11775696277618 -9.0318529605865479, 143.11775803565979 -9.0485199689865112, 143.13442397117615 -9.0485199689865112, 143.15109002590179 -9.0485210418701172, 143.16775596141815 -9.0485210418701172, 143.1844220161438 -9.0485219955444336)), ((143.95109105110168 -13.165166020393372, 143.96775698661804 -13.165166020393372, 143.984423995018 -13.165166020393372, 144.00109004974365 -13.165166020393372, 144.00109004974365 -13.148499965667725, 144.00109004974365 -13.131832957267761, 144.00109004974365 -13.115165948867798, 144.00109004974365 -13.09850001335144, 144.00109004974365 -13.081833004951477, 143.984423995018 -13.081833004951477, 143.96775805950165 -13.081833004951477, 143.95109105110168 -13.081832051277161, 143.93442499637604 -13.081832051277161, 143.91775894165039 -13.081832051277161, 143.90109205245972 -13.081832051277161, 143.88442599773407 -13.081832051277161, 143.86775994300842 -13.081832051277161, 143.85109305381775 -13.081832051277161, 143.8344269990921 -13.081830978393555, 143.81776106357574 -13.081830978393555, 143.8010950088501 -13.081830978393555, 143.78442800045013 -13.081830978393555, 143.76776206493378 -13.081830978393555, 143.75109601020813 -13.081830978393555, 143.73442900180817 -13.081830024719238, 143.71776306629181 -13.081830024719238, 143.70109701156616 -13.081830024719238, 143.6844300031662 -13.081830024719238, 143.66776406764984 -13.081830024719238, 143.65109801292419 -13.081830024719238, 143.63443195819855 -13.081830024719238, 143.61776506900787 -13.081828951835632, 143.60109901428223 -13.081828951835632, 143.58443295955658 -13.081828951835632, 143.56776607036591 -13.081828951835632, 143.55110001564026 -13.081828951835632, 143.53443396091461 -13.081828951835632, 143.51776802539825 -13.081828951835632, 143.50110101699829 -13.081827998161316, 143.48443496227264 -13.081827998161316, 143.46776902675629 -13.081827998161316, 143.45110297203064 -13.081827998161316, 143.43443596363068 -13.081827998161316, 143.41777002811432 -13.081827998161316, 143.40110397338867 -13.081827998161316, 143.38443696498871 -13.081827044487, 143.36777102947235 -13.081827044487, 143.35110402107239 -13.081827044487, 143.33443796634674 -13.081827044487, 143.31777203083038 -13.081827044487, 143.30110502243042 -13.081827044487, 143.28443896770477 -13.081827044487, 143.26777195930481 -13.081827044487, 143.25110602378845 -13.081825971603394, 143.25110602378845 -13.098492980003357, 143.25110602378845 -13.11515998840332, 143.25110602378845 -13.131826043128967, 143.25110602378845 -13.148493051528931, 143.25110507011414 -13.165159940719604, 143.26777195930481 -13.165159940719604, 143.28443801403046 -13.165159940719604, 143.30110502243042 -13.165159940719604, 143.31777095794678 -13.165159940719604, 143.33443701267242 -13.165159940719604, 143.35110402107239 -13.165159940719604, 143.36776995658875 -13.16516101360321, 143.38443696498871 -13.16516101360321, 143.40110301971436 -13.16516101360321, 143.41776895523071 -13.16516101360321, 143.43443596363068 -13.16516101360321, 143.45110201835632 -13.16516101360321, 143.46776795387268 -13.16516101360321, 143.48443400859833 -13.165161967277527, 143.50110101699829 -13.165161967277527, 143.51776695251465 -13.165161967277527, 143.5344330072403 -13.165161967277527, 143.55109906196594 -13.165161967277527, 143.5677649974823 -13.165161967277527, 143.58443200588226 -13.165161967277527, 143.60109806060791 -13.165163040161133, 143.61776399612427 -13.165163040161133, 143.63443005084991 -13.165163040161133, 143.65109705924988 -13.165163040161133, 143.66776299476624 -13.165163040161133, 143.68442904949188 -13.165163040161133, 143.70109605789185 -13.165163040161133, 143.7177619934082 -13.165163993835449, 143.73442900180817 -13.165163993835449, 143.75109505653381 -13.165163993835449, 143.76776099205017 -13.165163993835449, 143.78442800045013 -13.165163993835449, 143.80109405517578 -13.165163993835449, 143.81775999069214 -13.165163993835449, 143.8344269990921 -13.165164947509766, 143.85109305381775 -13.165164947509766, 143.86775898933411 -13.165164947509766, 143.88442599773407 -13.165164947509766, 143.90109205245972 -13.165164947509766, 143.91775798797607 -13.165164947509766, 143.93442499637604 -13.165164947509766, 143.95109105110168 -13.165166020393372)), ((138.0011500120163 -13.248525977134705, 138.08448302745819 -13.248525977134705, 138.08448302745819 -13.16519296169281, 138.0011500120163 -13.16519296169281, 138.0011500120163 -13.248525977134705)))");
var notWorkingFeature = AttachData(notWorkingGeom);
CreateTabFile(@"D:\temp\notWorking.tab", columns, notWorkingFeature);
}
public void CreateTabFileWorking()
{
var columns = CreateColumnDefinitions();
var workingGeom = new PointShape(1, 1);
var workingFeature = AttachData(workingGeom);
CreateTabFile(@"D:\temp\working.tab", columns, workingFeature);
}
private IEnumerable<TabDbfColumn> CreateColumnDefinitions()
{
var columns = new List<TabDbfColumn> {
new TabDbfColumn("ID", DbfColumnType.String, 10, 0, false, false),
new TabDbfColumn("X", DbfColumnType.Double, 20, 10, false, false)
};
return columns;
}
private Feature AttachData(BaseShape shape)
{
var feature = shape.GetFeature();
feature.ColumnValues.Add("ID", "P1");
feature.ColumnValues.Add("X", "1");
return feature;
}
private void CreateTabFile(string fileName, IEnumerable<TabDbfColumn> columns, Feature feature)
{
TabFeatureSource.CreateTabFile(fileName, columns, new List<Feature> { feature });
}