Skip to content

Commit

Permalink
[FEATURE] Delimited text provider supports curved WKT geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 22, 2015
1 parent 06553db commit f994e71
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -1148,7 +1148,7 @@ bool QgsDelimitedTextProvider::isValid()

int QgsDelimitedTextProvider::capabilities() const
{
return SelectAtId | CreateSpatialIndex;
return SelectAtId | CreateSpatialIndex | CircularGeometries;
}


Expand Down
26 changes: 22 additions & 4 deletions tests/src/python/test_qgsdelimitedtextprovider_wanted.py
Expand Up @@ -466,7 +466,7 @@ def test_011_read_wkt():
wanted['log'] = [
u'Errors in file testwkt.csv',
u'1 records discarded due to invalid geometry definitions',
u'7 records discarded due to incompatible geometry types',
u'10 records discarded due to incompatible geometry types',
u'The following lines were not loaded into QGIS due to errors:',
u'Invalid WKT at line 8',
]
Expand Down Expand Up @@ -513,7 +513,7 @@ def test_012_read_wkt_point():
wanted['log'] = [
u'Errors in file testwkt.csv',
u'1 records discarded due to invalid geometry definitions',
u'7 records discarded due to incompatible geometry types',
u'10 records discarded due to incompatible geometry types',
u'The following lines were not loaded into QGIS due to errors:',
u'Invalid WKT at line 8',
]
Expand Down Expand Up @@ -556,11 +556,23 @@ def test_013_read_wkt_line():
'#fid': 14,
'#geometry': 'LineString (10 20, 11 21)',
},
15: {
'id': u'14',
'description': u'CircularString',
'#fid': 15,
'#geometry': 'CircularString (268 415, 227 505, 227 406)',
},
17: {
'id': u'16',
'description': u'CompoundCurve',
'#fid': 17,
'#geometry': 'CompoundCurve ((5 3, 5 13), CircularString(5 13, 7 15, 9 13), (9 13, 9 3), CircularString(9 3, 7 1, 5 3))',
},
}
wanted['log'] = [
u'Errors in file testwkt.csv',
u'1 records discarded due to invalid geometry definitions',
u'7 records discarded due to incompatible geometry types',
u'8 records discarded due to incompatible geometry types',
u'The following lines were not loaded into QGIS due to errors:',
u'Invalid WKT at line 8',
]
Expand All @@ -585,11 +597,17 @@ def test_014_read_wkt_polygon():
'#fid': 7,
'#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)))',
},
16: {
'id': u'15',
'description': u'CurvePolygon',
'#fid': 16,
'#geometry': 'CurvePolygon (CircularString (1 3, 3 5, 4 7, 7 3, 1 3))',
},
}
wanted['log'] = [
u'Errors in file testwkt.csv',
u'1 records discarded due to invalid geometry definitions',
u'10 records discarded due to incompatible geometry types',
u'12 records discarded due to incompatible geometry types',
u'The following lines were not loaded into QGIS due to errors:',
u'Invalid WKT at line 8',
]
Expand Down
4 changes: 3 additions & 1 deletion tests/testdata/delimitedtext/testwkt.csv
Expand Up @@ -12,4 +12,6 @@ id|description|geom_wkt
11|Measure in line|LINESTRING(10.0 20.0 30.0, 11.0 21.0 31.0)
12|Z in line|LINESTRING Z(10.0 20.0 30.0, 11.0 21.0 31.0)
13|Measure and Z in line|LINESTRING ZM(10.0 20.0 30.0 40.0, 11.0 21.0 31.0 41.0)

14|CircularString|CIRCULARSTRING(268 415,227 505,227 406)
15|CurvePolygon|CURVEPOLYGON(CIRCULARSTRING(1 3, 3 5, 4 7, 7 3, 1 3))
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 comments on commit f994e71

Please sign in to comment.