[gdal-dev] how to use the filter option -where within an mysql
request?
Stefan Schantz
SSchantz at BfS.de
Tue Dec 20 07:21:10 EST 2011
Hi,
I don't understand the usage of the filter option "-where" of ogrinfo.
If I try the following statement , it works and I get 1678 hits:
ogrinfo -ro -so
MYSQL:onmon,host=10.130.63.11,user=user,password=user,port=3306,tables=result_current
-sql "SELECT result_current.value AS wert, result_current.end_measure,
locality.geom FROM result_current JOIN locality ON
result_current.locality_code = locality.locality_code where end_measure
= '2011-12-20'"
MySQL: table result_current has FID column nuclide.
OGR: ...
using driver `MySQL' successful.
Layer name: sql_statement
Geometry: Point
Feature Count: 1678
Extent: (6.041560, 47.398590) - (15.026700, 54.889580)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
Geometry Column = geom
wert: Real (21.6)
end_measure: DateTime (0.0)
MySQL: 3356 features read on layer 'sql_statement'.
OGR: GetLayerCount() = 1
If I do the same with the filter option "-where", i got some errors and
no hits:
ogrinfo -ro -so
MYSQL:onmon,host=10.130.63.11,user=readonly,password=readonly,port=3306,tables=result_current
-sql "SELECT result_current.value AS wert, result_current.end_measure,
locality.geom FROM result_current JOIN locality ON
result_current.locality_code = locality.locality_code where end_measure
= '2011-12-20'" -where "end_measure = '2011-12-20'"
MySQL: table result_current has FID column nuclide.
OGR: ...
using driver `MySQL' successful.
Layer name: sql_statement
Geometry: Point
OGRFeatureQuery: Illegal operation (3) on list or binary field.
...
Feature Count: 0
OGRFeatureQuery: Illegal operation (3) on list or binary field.
...
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
Geometry Column = geom
wert: Real (21.6)
end_measure: DateTime (0.0)
MySQL: 3356 features read on layer 'sql_statement'.
OGR: GetLayerCount() = 1
Also if I remove the "where"- clause in the sql-statement, i get the
same result.
So I wonder how to use the "-where" filter option in ogrinfo.
The dokumentation is not so clear.
Thanks for help!
regards,
Stefan
More information about the gdal-dev
mailing list