[Gdal-dev] OGR: VRT
Stephan Holl
stephan.holl at intevation.de
Wed Nov 15 11:04:03 EST 2006
Dear List,
I am connecting to a mysql-table using OGRs VRT-driver.
My ovt-file:
OGRVRTDataSource>
<OGRVRTLayer name='values'>
<SrcDataSource>MYSQL:usr_web1_1,user=web1,host=localhost,port=3306,tables=n2n_flmflaeche</SrcDataSource>
<SrcSQL>select n2n_wert, n2n_idflm, n2n_wertdat, n2n_idflaeche, frmt_wert,
replace(replace(replace(format(n2n_wert,3),'.',';'),',','.'),';',',') as
format_wert from n2n_flmflaeche
where n2n_idflm = 1207
and n2n_wertdat between '2004-01-01' and '2004-12-31'
order by n2n_wertdat</SrcSQL>
</OGRVRTLayer>
</OGRVRTDataSource>
The Database-query using mysql commandline-tools results in in 1 row:
select n2n_wert, frmt_wert,
replace(replace(replace(format(n2n_wert,3),'.',';'),',','.'),';',',') as
format_wert from n2n_flmflaeche
where n2n_idflm = 1207
and n2n_wertdat between '2004-01-01' and '2004-12-31'
order by n2n_wertdat;
+----------+-----------+-------------+
| n2n_wert | frmt_wert | format_wert |
+----------+-----------+-------------+
| 95.600 | 95,600 | 95,600 |
+----------+-----------+-------------+
1 row in set (0.01 sec)
The datatype of n2n_wert is decimal.
All good for now.
Using ogrinfo on my ovf-file it gives a strange rounding value
Layer name: values
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
n2n_wert: Real (0.0)
n2n_idflm: Integer (0.0)
n2n_wertdat: String (0.0)
n2n_idflaeche: String (0.0)
frmt_wert: String (0.0)
format_wert: String (0.0)
OGRFeature(values):0
n2n_wert (Real) = 95.59999999999999 <--- strange, should be 95.600
n2n_idflm (Integer) = 1207
n2n_wertdat (String) = 2004-12-31
n2n_idflaeche (String) = 04000000
frmt_wert (String) = 95,600
format_wert (String) = 95,600
Is this a known problem?
I am on Debian with gdal-1.2.6
Best regards
Stephan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061115/15ee1c15/attachment.bin
More information about the Gdal-dev
mailing list