Skip to content

Commit f994e71

Browse files
committed
[FEATURE] Delimited text provider supports curved WKT geometries
1 parent 06553db commit f994e71

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

src/providers/delimitedtext/qgsdelimitedtextprovider.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ bool QgsDelimitedTextProvider::isValid()
11481148

11491149
int QgsDelimitedTextProvider::capabilities() const
11501150
{
1151-
return SelectAtId | CreateSpatialIndex;
1151+
return SelectAtId | CreateSpatialIndex | CircularGeometries;
11521152
}
11531153

11541154

tests/src/python/test_qgsdelimitedtextprovider_wanted.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def test_011_read_wkt():
466466
wanted['log'] = [
467467
u'Errors in file testwkt.csv',
468468
u'1 records discarded due to invalid geometry definitions',
469-
u'7 records discarded due to incompatible geometry types',
469+
u'10 records discarded due to incompatible geometry types',
470470
u'The following lines were not loaded into QGIS due to errors:',
471471
u'Invalid WKT at line 8',
472472
]
@@ -513,7 +513,7 @@ def test_012_read_wkt_point():
513513
wanted['log'] = [
514514
u'Errors in file testwkt.csv',
515515
u'1 records discarded due to invalid geometry definitions',
516-
u'7 records discarded due to incompatible geometry types',
516+
u'10 records discarded due to incompatible geometry types',
517517
u'The following lines were not loaded into QGIS due to errors:',
518518
u'Invalid WKT at line 8',
519519
]
@@ -556,11 +556,23 @@ def test_013_read_wkt_line():
556556
'#fid': 14,
557557
'#geometry': 'LineString (10 20, 11 21)',
558558
},
559+
15: {
560+
'id': u'14',
561+
'description': u'CircularString',
562+
'#fid': 15,
563+
'#geometry': 'CircularString (268 415, 227 505, 227 406)',
564+
},
565+
17: {
566+
'id': u'16',
567+
'description': u'CompoundCurve',
568+
'#fid': 17,
569+
'#geometry': 'CompoundCurve ((5 3, 5 13), CircularString(5 13, 7 15, 9 13), (9 13, 9 3), CircularString(9 3, 7 1, 5 3))',
570+
},
559571
}
560572
wanted['log'] = [
561573
u'Errors in file testwkt.csv',
562574
u'1 records discarded due to invalid geometry definitions',
563-
u'7 records discarded due to incompatible geometry types',
575+
u'8 records discarded due to incompatible geometry types',
564576
u'The following lines were not loaded into QGIS due to errors:',
565577
u'Invalid WKT at line 8',
566578
]
@@ -585,11 +597,17 @@ def test_014_read_wkt_polygon():
585597
'#fid': 7,
586598
'#geometry': 'MultiPolygon (((10 10,10 20,20 20,20 10,10 10),(14 14,14 16,16 16,14 14)),((30 30,30 35,35 35,30 30)))',
587599
},
600+
16: {
601+
'id': u'15',
602+
'description': u'CurvePolygon',
603+
'#fid': 16,
604+
'#geometry': 'CurvePolygon (CircularString (1 3, 3 5, 4 7, 7 3, 1 3))',
605+
},
588606
}
589607
wanted['log'] = [
590608
u'Errors in file testwkt.csv',
591609
u'1 records discarded due to invalid geometry definitions',
592-
u'10 records discarded due to incompatible geometry types',
610+
u'12 records discarded due to incompatible geometry types',
593611
u'The following lines were not loaded into QGIS due to errors:',
594612
u'Invalid WKT at line 8',
595613
]

tests/testdata/delimitedtext/testwkt.csv

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ id|description|geom_wkt
1212
11|Measure in line|LINESTRING(10.0 20.0 30.0, 11.0 21.0 31.0)
1313
12|Z in line|LINESTRING Z(10.0 20.0 30.0, 11.0 21.0 31.0)
1414
13|Measure and Z in line|LINESTRING ZM(10.0 20.0 30.0 40.0, 11.0 21.0 31.0 41.0)
15-
15+
14|CircularString|CIRCULARSTRING(268 415,227 505,227 406)
16+
15|CurvePolygon|CURVEPOLYGON(CIRCULARSTRING(1 3, 3 5, 4 7, 7 3, 1 3))
17+
16|CompoundCurve|COMPOUNDCURVE((5 3, 5 13), CIRCULARSTRING(5 13, 7 15, 9 13), (9 13, 9 3), CIRCULARSTRING(9 3, 7 1, 5 3))

0 commit comments

Comments
 (0)