Re: [GRASS-dev] datetime function in v.in.ogr

2019-06-27 Thread Stefan Blumentrath
Hi Paulo,

Maybe SQLITE dialect [1] in ogr2ogr could help?!
Could be worth a try to create a vector VRT [2] with ogr2ogr and import that.
No idea if it is faster but could be an option...

Cheers
Stefan

1: https://gdal.org/programs/ogr2ogr.html#cmdoption-ogr2ogr-dialect
2: https://gdal.org/drivers/vector/vrt.html

From: grass-dev  On Behalf Of Paulo van 
Breugel
Sent: torsdag 27. juni 2019 23:15
To: Markus Metz 
Cc: GRASS developers email list 
Subject: Re: [GRASS-dev] datetime function in v.in.ogr




Op 27 juni 2019 23:05:17 schreef Markus Metz 
mailto:markus.metz.gisw...@gmail.com>>:


On Thu, Jun 27, 2019 at 9:27 PM Paulo van Breugel 
mailto:p.vanbreu...@gmail.com>> wrote:
>
> Hi devs,
>
> I am trying to import a shapefile using v.in.ogr, filtering on date
> using datetime, e.g.,
>
> v.in.ogr input=myshapefile.shp layer=myshapefile output=outputlayer
> where="datm_start >= datetime('2019-01-01')"
>
> I am getting the message:
>
> ERROR 1: Undefined function 'datetime' used.
> ERROR: Error setting attribute filter 'datm_start >= datetime('2019-01-01')'
>
> Does this mean it is not possible to use functions in v.in.ogr? Or am I
> doing somthing wrong?

The OGR shapefile driver does not support this function. You need to import the 
shapefile into GRASS, using anything but the dbf driver as database driver 
(default is sqlite), then try to filter with v.extract where="datm_start >= 
datetime('2019-01-01')"

Ok, thanks, was hoping I could do a selection before to safe on the time ik 
takes to import. I'll look for a way to filter before import using another tool.



HTH,

Markus M

>
> Running grass gis 7.6, Linux.
>
>
> Cheers,
>
> Paulo
>
>
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/grass-dev

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] datetime function in v.in.ogr

2019-06-27 Thread Paulo van Breugel



Op 27 juni 2019 23:05:17 schreef Markus Metz :



On Thu, Jun 27, 2019 at 9:27 PM Paulo van Breugel  
wrote:


Hi devs,

I am trying to import a shapefile using v.in.ogr, filtering on date
using datetime, e.g.,

v.in.ogr input=myshapefile.shp layer=myshapefile output=outputlayer
where="datm_start >= datetime('2019-01-01')"

I am getting the message:

ERROR 1: Undefined function 'datetime' used.
ERROR: Error setting attribute filter 'datm_start >= datetime('2019-01-01')'

Does this mean it is not possible to use functions in v.in.ogr? Or am I
doing somthing wrong?




The OGR shapefile driver does not support this function. You need to import 
the shapefile into GRASS, using anything but the dbf driver as database 
driver (default is sqlite), then try to filter with v.extract 
where="datm_start >= datetime('2019-01-01')"


Ok, thanks, was hoping I could do a selection before to safe on the time ik 
takes to import. I'll look for a way to filter before import using another 
tool.






HTH,


Markus M




Running grass gis 7.6, Linux.


Cheers,

Paulo


___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev


___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] datetime function in v.in.ogr

2019-06-27 Thread Markus Metz
On Thu, Jun 27, 2019 at 9:27 PM Paulo van Breugel 
wrote:
>
> Hi devs,
>
> I am trying to import a shapefile using v.in.ogr, filtering on date
> using datetime, e.g.,
>
> v.in.ogr input=myshapefile.shp layer=myshapefile output=outputlayer
> where="datm_start >= datetime('2019-01-01')"
>
> I am getting the message:
>
> ERROR 1: Undefined function 'datetime' used.
> ERROR: Error setting attribute filter 'datm_start >=
datetime('2019-01-01')'
>
> Does this mean it is not possible to use functions in v.in.ogr? Or am I
> doing somthing wrong?

The OGR shapefile driver does not support this function. You need to import
the shapefile into GRASS, using anything but the dbf driver as database
driver (default is sqlite), then try to filter with v.extract
where="datm_start >= datetime('2019-01-01')"

HTH,

Markus M

>
> Running grass gis 7.6, Linux.
>
>
> Cheers,
>
> Paulo
>
>
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] datetime function in v.in.ogr

2019-06-27 Thread Paulo van Breugel

Hi devs,

I am trying to import a shapefile using v.in.ogr, filtering on date 
using datetime, e.g.,


v.in.ogr input=myshapefile.shp layer=myshapefile output=outputlayer 
where="datm_start >= datetime('2019-01-01')"


I am getting the message:

ERROR 1: Undefined function 'datetime' used.
ERROR: Error setting attribute filter 'datm_start >= datetime('2019-01-01')'

Does this mean it is not possible to use functions in v.in.ogr? Or am I 
doing somthing wrong?


Running grass gis 7.6, Linux.


Cheers,

Paulo


___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev