#6216 closed defect (duplicate)
Filtering of VRT+CSV issue
Reported by: | dr | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 1.11.3 |
Severity: | normal | Keywords: | sql |
Cc: |
Description
Try to filter records from CSV file using VRT but it doesn't work.
$ ogrinfo --version GDAL 1.11.3, released 2015/09/16 $ cat test.csv number,regcode,regname,index,country,region,subregion,city,street,house,lat,lon,level,wkt 000028198,1145,г.Москва,,,,, МОСКВА,ПРОФСОЮЗНАЯ,,55.621147,37.507687,street, $ cat test.vrt <OGRVRTDataSource> <OGRVRTLayer name="test"> <LayerSRS>WGS84</LayerSRS> <GeometryType>wkbPoint</GeometryType> <GeometryField encoding="PointFromColumns" x="lon" y="lat"/> <SrcDataSource>test.csv</SrcDataSource> <SrcSQL>SELECT * from test WHERE level = 'street'</SrcSQL> </OGRVRTLayer> </OGRVRTDataSource> $ ogrinfo -al -ro test.vrt | grep "Feature Count" Feature Count: 0
Feature Count should be 1.
Change History (7)
comment:1 by , 8 years ago
comment:3 by , 8 years ago
comment:4 by , 8 years ago
Testing with GDAL 2.1-dev on Windows. I had to edit your csv because copy-paste made mess with the cyrillic letters. I used this data:
number,regcode,regname,index,country,region,subregion,city,street,house,lat,lon,level,wkt 000028198,1145,M,,,,, M2,M3,,55.621147,37.507687,street,
With your unmodified VRT (so no SQLite dialect) and ogrinfo I am getting:
ogrinfo csv_sql.vrt -al INFO: Open of `csv_sql.vrt' using driver `OGR_VRT' successful. Layer name: test Geometry: Point Feature Count: 1 Extent: (37.507687, 55.621147) - (37.507687, 55.621147) Layer SRS WKT: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]] number: String (0.0) regcode: String (0.0) regname: String (0.0) index: String (0.0) country: String (0.0) region: String (0.0) subregion: String (0.0) city: String (0.0) street: String (0.0) house: String (0.0) lat: String (0.0) lon: String (0.0) level: String (0.0) wkt: String (0.0) OGRFeature(test):1 number (String) = 000028198 regcode (String) = 1145 regname (String) = M index (String) = country (String) = region (String) = subregion (String) = city (String) = M2 street (String) = M3 house (String) = lat (String) = 55.621147 lon (String) = 37.507687 level (String) = street wkt (String) = POINT (37.507687 55.621147)
By editing 'street' into 'stret' in the VRT the result is zero features. Hard to say why it works for me. We may have different GDAL versions and our csv data for sure is different as well as the locale of our computers. You could try add the csv file with cyrillic letters as an UTF-8 formatted text file to the ticket if that happens to make the difference.
comment:5 by , 8 years ago
Described issue was fixed for 2.x branch as described here but may be any workaround exist for 1.x?
comment:6 by , 8 years ago
Keywords: | sql added; vrt removed |
---|
It seems that this issue comes due to limitations described here.