2

I'm using the mitab.dll to read MapInfo files (*.tab + friends). These files may contain simple polylines and also curved lines. So far, I have been unable to distinguish between these two and read everything as polylines. Is there any mitab-API call that allows me to determine which of these two line types I am reading?

(simplified) code:

procedure HandlePolyline(_Feature: mitab_Feature);
var
  i, j: LongInt;
  pointCount: LongInt;
  partCount: LongInt;
  X, Y: array of Double;
begin
  partCount := FMitabDll.get_parts(_Feature);
  for i := 0 to partCount - 1 do begin
    pointCount := FMitabDll.get_vertex_count(_Feature, i);
    SetLength(X, pointCount);
    SetLength(Y, pointCount);

    for j := 0 to pointCount - 1 do begin
      X[j] := FMitabDll.get_vertex_x(_Feature, i, j);
      Y[j] := FMitabDll.get_vertex_y(_Feature, i, j);
    end;
    // -> Here I have got a polyline, but it might be a curved line, how do I know?
  end;
end;


i := 1;
repeat
  feature := FMitabDll.read_feature(FTabHandle, i);
  FeatureType := FMitabDll.get_type(feature);
  case FeatureType of
    TABFC_Polyline: HandlePolyline(feature);
  end;
  i := FMitabDll.next_feature_id(FTabHandle, i);
  FMitabDll.destroy_feature(feature);
until i = -1;

(This is with Delphi 2077, but I take any other solution that uses mitab.)

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
  • `case FeatureType of TABFC_Arc: HandleArc(feature); ...` or something like that ? – TLama Jan 13 '15 at 17:59
  • Unfortunately it's not that easy. Both line types are of FeatureType TABFC_Polyline. That's why I only recently noticed that there is a problem. – dummzeuch Jan 14 '15 at 08:24

1 Answers1

0

Do both line types exist?

Since you posted your question on several sites and apparently got no responses and since online documentation for Mitab does not mention curved polygons, nor even splines, I wonder whether there is a curve characteristic for polylines.

Ast Pace
  • 152
  • 4
  • 16
  • Yes, they do. We receive both types from customers and the hard part is to know which one it is. MapInfo can distinguish between them somehow. – dummzeuch Mar 25 '15 at 15:06
  • So, the customers are supplying two types of poly without distinguishing which kind. When you draw the polys, they all come out as straight line segments and you believe some of them should be curves or smoothed polygons? How do YOU know? Perhaps the customer is using smoothing routine on some polylines, but is not supplying any clues to let you know which they might be? Maybe you could ask a customer directly. – Ast Pace Mar 25 '15 at 16:52
  • I know, because they look different in MapInfo. The customers aren't even aware that there are different types. They just use MapInfo or even worse, export from some other GIS they don't even understand. They are not really knowledgeable in this area. – dummzeuch Mar 26 '15 at 11:29