@@ -145,6 +145,21 @@ OGRFeature *OGRILI1Layer::GetFeatureRef( long nFID )
145
145
return NULL ;
146
146
}
147
147
148
+ OGRFeature *OGRILI1Layer::GetFeatureRef ( const char *fid )
149
+
150
+ {
151
+ OGRFeature *poFeature;
152
+
153
+ ResetReading ();
154
+ while ( (poFeature = GetNextFeatureRef ()) != NULL )
155
+ {
156
+ if ( !strcmp ( poFeature->GetFieldAsString (0 ), fid ) )
157
+ return poFeature;
158
+ }
159
+
160
+ return NULL ;
161
+ }
162
+
148
163
/* ***********************************************************************/
149
164
/* GetFeatureCount() */
150
165
/* ***********************************************************************/
@@ -489,9 +504,16 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer,
489
504
poSurfaceLineLayer->ResetReading ();
490
505
while (OGRFeature *linefeature = poSurfaceLineLayer->GetNextFeatureRef ()) {
491
506
// OBJE entries with same _RefTID are polygon rings of same feature
492
- // TODO: non-numeric _RefTID/FID is not supported yet!
493
- GIntBig reftid = linefeature->GetFieldAsInteger64 (1 ); // _RefTID
494
- OGRFeature *feature = GetFeatureRef ((int )reftid);
507
+ OGRFeature *feature;
508
+ if (poFeatureDefn->GetFieldDefn (0 )->GetType () == OFTString)
509
+ {
510
+ feature = GetFeatureRef (linefeature->GetFieldAsString (1 ));
511
+ }
512
+ else
513
+ {
514
+ GIntBig reftid = linefeature->GetFieldAsInteger64 (1 );
515
+ feature = GetFeatureRef ((int )reftid);
516
+ }
495
517
if (feature) {
496
518
if (!feature->GetGeomFieldRef (nSurfaceFieldIndex)) {
497
519
OGRCurvePolygon *newpoly = (geomType == wkbPolygon) ?
@@ -548,7 +570,7 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer,
548
570
}
549
571
} else {
550
572
CPLError ( CE_Warning, CPLE_AppDefined,
551
- " Couldn't join feature FID " CPL_FRMT_GIB, reftid );
573
+ " Couldn't join feature FID " CPL_FRMT_GIB, linefeature-> GetFieldAsInteger64 ( 1 ) );
552
574
}
553
575
}
554
576
0 commit comments