<div dir="ltr">OK, so this is a version thing. I upgraded the gdal version and the following sqlite3 version 3.39.3 then unixepoch works(using the SQLITE dialect)<div><br></div><div>ogrinfo -dialect SQLITE -sql "select * from li_flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('2013-06-20T17:00:29Z') and unixepoch('2013-06-20T17:00:29Z')+300" /data/mapserver/tile-index/*<br>INFO: Open of `/data/mapserver/tile-index/points-20130620070000.fgb'<br> using driver `FlatGeobuf' successful.<br>layer names ignored in combination with -sql.<br><br>Layer name: SELECT<br>Geometry: Point<br>Feature Count: 17<br>Extent: (7.254900, -6.423300) - (58.263300, 51.656400)<br>Layer SRS WKT:<br>GEOGCRS["WGS 84",<br> ENSEMBLE["World Geodetic System 1984 ensemble",<br> MEMBER["World Geodetic System 1984 (Transit)"],<br> MEMBER["World Geodetic System 1984 (G730)"],<br> MEMBER["World Geodetic System 1984 (G873)"],<br> MEMBER["World Geodetic System 1984 (G1150)"],<br> MEMBER["World Geodetic System 1984 (G1674)"],<br> MEMBER["World Geodetic System 1984 (G1762)"],<br> MEMBER["World Geodetic System 1984 (G2139)"],<br> ELLIPSOID["WGS 84",6378137,298.257223563,<br> LENGTHUNIT["metre",1]],<br> ENSEMBLEACCURACY[2.0]],<br> PRIMEM["Greenwich",0,<br> ANGLEUNIT["degree",0.0174532925199433]],<br> CS[ellipsoidal,2],<br> AXIS["geodetic latitude (Lat)",north,<br> ORDER[1],<br> ANGLEUNIT["degree",0.0174532925199433]],<br> AXIS["geodetic longitude (Lon)",east,<br> ORDER[2],<br> ANGLEUNIT["degree",0.0174532925199433]],<br> USAGE[<br> SCOPE["Horizontal component of 3D system."],<br> AREA["World."],<br> BBOX[-90,-180,90,180]],<br> ID["EPSG",4326]]<br>Data axis to CRS axis mapping: 2,1<br>Geometry Column = GEOMETRY<br>TimeStamp: String (0.0)<br>OGRFeature(SELECT):0<br> TimeStamp (String) = 2013-06-20T17:00:29Z<br> POINT (11.3157 -5.3703)<br></div><div><br></div><div>Trygve Aspenes</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ons. 19. okt. 2022 kl. 14:10 skrev Trygve Aspenes <<a href="mailto:trygveas@met.no">trygveas@met.no</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi<div><br></div><div>I have some FlatGeoBuf files I have generated with the python fiona library. This is a lat lon point and a timestamp. So I want to filter by timestamp. What I have come up with is to use gdal sql dialect like this:<br><br>ogrinfo -sql "select * from flatgeobuf_demo where TimeStamp>='2013-06-20T17:00:29Z'" flatgeobuf-data/*<br>INFO: Open of `flatgeobuf-data/points-20130620070000.fgb'<br> using driver `FlatGeobuf' successful.<br>layer names ignored in combination with -sql.<br><br>Layer name: flatgeobuf_demo<br>Geometry: Point<br>Feature Count: 17<br>Extent: (-55.071900, -57.866400) - (58.263300, 51.737400)<br>Layer SRS WKT:<br>GEOGCRS["WGS 84",<br> ENSEMBLE["World Geodetic System 1984 ensemble",<br> MEMBER["World Geodetic System 1984 (Transit)"],<br> MEMBER["World Geodetic System 1984 (G730)"],<br> MEMBER["World Geodetic System 1984 (G873)"],<br> MEMBER["World Geodetic System 1984 (G1150)"],<br> MEMBER["World Geodetic System 1984 (G1674)"],<br> MEMBER["World Geodetic System 1984 (G1762)"],<br> ELLIPSOID["WGS 84",6378137,298.257223563,<br> LENGTHUNIT["metre",1]],<br> ENSEMBLEACCURACY[2.0]],<br> PRIMEM["Greenwich",0,<br> ANGLEUNIT["degree",0.0174532925199433]],<br> CS[ellipsoidal,2],<br> AXIS["geodetic latitude (Lat)",north,<br> ORDER[1],<br> ANGLEUNIT["degree",0.0174532925199433]],<br> AXIS["geodetic longitude (Lon)",east,<br> ORDER[2],<br> ANGLEUNIT["degree",0.0174532925199433]],<br> USAGE[<br> SCOPE["Horizontal component of 3D system."],<br> AREA["World."],<br> BBOX[-90,-180,90,180]],<br> ID["EPSG",4326]]<br>Data axis to CRS axis mapping: 2,1<br>Geometry Column = _ogr_geometry_<br>TimeStamp: String (0.0)<br>OGRFeature(flatgeobuf_demo):19<br> TimeStamp (String) = 2013-06-20T17:00:29Z<br> POINT (11.3157 -5.3703)<br><div><truncated></div><div><br></div><div>However what I want is to make a query with all points between one timestamp and another. And here is my problem: the time parameters come from a request query and have the format YYYY-mm-ddTHH:MM:SSZ. So I need a way to say:</div><div><br></div><div>ogrinfo -sql "select * from flatgeobuf_demo where TimeStamp between '2013-06-20T17:00:29Z' and '2013-06-20T17:00:29Z'+TimeInterval" flatgeobuf-data/*<br></div><div><br></div><div>I could rewrite the flatgeobuf file setting TimeStamp as a float containing the epoch instead. But then I can not convert the incoming query with the time from my request( with fixed format)</div><div><br></div><div>Any idea if, and hopefully how, I can achieve this in OGR SQL?</div><div><br></div><div>Trygve Aspenes</div><div>--<br></div></div></div></div><div dir="ltr"><div dir="ltr"><div><div dir="ltr">Trygve Aspenes - Senioringeniør/Senior Engineer
<br>Fjernmåling Utvikling/Remotesensing development Telefon/Phone: 22963133
<br>Fjernmålingsavdelingen/Remotesensing department Postboks 43, Blindern
<br>Metklim 0313 OSLO
<br>Meteorologisk Institutt
<br>/Norwegian Meteorological Institute NORWAY
</div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Trygve Aspenes - Senioringeniør/Senior Engineer
<br>Fjernmåling Utvikling/Remotesensing development Telefon/Phone: 22963133
<br>Fjernmålingsavdelingen/Remotesensing department Postboks 43, Blindern
<br>Metklim 0313 OSLO
<br>Meteorologisk Institutt
<br>/Norwegian Meteorological Institute NORWAY
</div></div></div></div>