[Qgis-user] OGR VRT issue?
Brent Wood
Brent.Wood at niwa.co.nz
Sun Dec 19 18:11:28 PST 2021
Hi,
I'm looking to open a sqlite3 (not spatialite) database in QGIS.
I have a table in the db with a lat column & a lon column with EPSG:4326 coordinates
I have written a VRT file to enable opening the table with a virtual geometry column. This works fine with ogrinfo on the command line, but creates an empty layer with no geometry type, columns or features in QGIS.
The VRT file contains:
<OGRVRTDataSource>
<OGRVRTLayer name="test">
<SrcDataSource>test.db</SrcDataSource>
<SrcLayer>test</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
</OGRVRTLayer>
</OGRVRTDataSource>
Testing with ogrinfo is successful, the text returned is below.
The table contents are:
sqlite> select * from test;
id|lat|lon
1|-41.354|174.567
Can anyone explain why this fails in QGIS?
I'm running QGIS v3.16.11 on Linux (deb platform)
Thanks,
Brent Wood
ogrinfo result:
ogrinfo -geom=YES -al test.vrt
INFO: Open of `test.vrt'
using driver `OGR_VRT' successful.
- 'VirtualXPath' [XML Path Language - XPath]
Layer name: test
Geometry: Point
Feature Count: 1
Extent: (-41.354000, 174.567000) - (-41.354000, 174.567000)
Layer SRS WKT:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
FID Column = rowid
id: Integer (0.0)
lat: Real (0.0)
lon: Real (0.0)
OGRFeature(test):1
id (Integer) = 1
lat (Real) = -41.354
lon (Real) = 174.567
POINT (-41.354 174.567)
[https://www.niwa.co.nz/static/niwa-2018-horizontal-180.png] <https://www.niwa.co.nz>
Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529
National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz<https://www.niwa.co.nz> Facebook<https://www.facebook.com/nzniwa> LinkedIn<https://www.linkedin.com/company/niwa> Twitter<https://twitter.com/niwa_nz> Instagram<https://www.instagram.com/niwa_science>
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211220/33fac928/attachment.html>
More information about the Qgis-user
mailing list