[GRASS-user] postgresql geometry parameter not respected in v.in.ogr -r

Dear list

The syntax of v.in.ogr ignores the "geometry" Parameter, when using the "spatial" Parameter or "-r". A workaround is the use of v.clip and g.rename.

I am a longterm user, but unregular user and have no userid to start a ticket. Hope this helps for future development nontheless.

Best,

Patrick

#using flag "-r" and "spatial" finds "2990 vertices registered"

v.in.ogr spatial="2653156, 1249949, 2675000, 1267232" input="PG:dbname=psql_local" layer=${DBSCHEMA}.${DATASET} out=gr_${DATASET}_${REFYEAR} type=point geometry="geom_2" -o --o

v.in.ogr -r input="PG:dbname=psql_local" layer=${DBSCHEMA}.${DATASET} out=gr_${DATASET}_${REFYEAR} type=point geometry="geom_2" -o --o #2990 vertices registered

#clipping with same region after loading reduces to "1079 primitives registered"

v.clip in=gr_${DATASET}_${REFYEAR} out=gr_${DATASET}clip_${REFYEAR} -r

On Tue, Feb 26, 2019 at 5:05 PM patrick_s <patrick_GIS@gmx.net> wrote:

Dear list

The syntax of v.in.ogr ignores the “geometry” Parameter, when using the
“spatial” Parameter or “-r”. A workaround is the use of v.clip and g.rename.

I am a longterm user, but unregular user and have no userid to start a

ticket. Hope this helps for future development nontheless.

Of course it helps! Which GRASS version are you using? v.in.ogr has changed quite a bit recently, therefore we recommend to use GRASS 7.6.

Best,

Markus M

Best,

Patrick

#using flag “-r” and “spatial” finds “2990 vertices registered”

v.in.ogr spatial=“2653156, 1249949, 2675000, 1267232”
input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o

v.in.ogr -r input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o #2990
vertices registered

#clipping with same region after loading reduces to “1079 primitives
registered”

v.clip in=gr_${DATASET}${REFYEAR} out=gr${DATASET}clip_${REFYEAR} -r


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

Thanks Markus

My GRASS-version is 7.4 from standard Ubuntu 18.04.2 LTS repository;

Regards,

Patrick

···

On 26/02/2019 21.12, Markus Metz wrote:

On Tue, Feb 26, 2019 at 5:05 PM patrick_s <patrick_GIS@gmx.net> wrote:

Dear list

The syntax of v.in.ogr ignores the “geometry” Parameter, when using the
“spatial” Parameter or “-r”. A workaround is the use of v.clip and g.rename.

I am a longterm user, but unregular user and have no userid to start a

ticket. Hope this helps for future development nontheless.

Of course it helps! Which GRASS version are you using? v.in.ogr has changed quite a bit recently, therefore we recommend to use GRASS 7.6.

Best,

Markus M

Best,

Patrick

#using flag “-r” and “spatial” finds “2990 vertices registered”

v.in.ogr spatial=“2653156, 1249949, 2675000, 1267232”
input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o

v.in.ogr -r input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o #2990
vertices registered

#clipping with same region after loading reduces to “1079 primitives
registered”

v.clip in=gr_${DATASET}${REFYEAR} out=gr${DATASET}clip_${REFYEAR} -r


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

On Tue, Feb 26, 2019 at 9:17 PM patrick_s <patrick_GIS@gmx.net> wrote:

Thanks Markus

My GRASS-version is 7.4 from standard Ubuntu 18.04.2 LTS repository;

This should work as expected. AFAICT, the spatial option and the -r flag are properly passed to OGR.

Are there any warnings or errors in the output messages of v.in.ogr?

In order to help testing, you could use OGR directly to extract a spatial subset:

ogr2ogr -spat 2653156, 1249949, 2675000, 1267232 -geomfield geom_2 -f GPKG test.gpkg “PG:dbname=psql_local” layer ${DBSCHEMA}.${DATASET}

and test if you get the expected result.

The arguments for ogr2ogr are derived from your information and untested.

Markus M

Regards,

Patrick

On 26/02/2019 21.12, Markus Metz wrote:

On Tue, Feb 26, 2019 at 5:05 PM patrick_s <patrick_GIS@gmx.net> wrote:

Dear list

The syntax of v.in.ogr ignores the “geometry” Parameter, when using the
“spatial” Parameter or “-r”. A workaround is the use of v.clip and g.rename.

I am a longterm user, but unregular user and have no userid to start a
ticket. Hope this helps for future development nontheless.

Of course it helps! Which GRASS version are you using? v.in.ogr has changed quite a bit recently, therefore we recommend to use GRASS 7.6.

Best,

Markus M

Best,

Patrick

#using flag “-r” and “spatial” finds “2990 vertices registered”

v.in.ogr spatial=“2653156, 1249949, 2675000, 1267232”
input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o

v.in.ogr -r input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o #2990
vertices registered

#clipping with same region after loading reduces to “1079 primitives
registered”

v.clip in=gr_${DATASET}${REFYEAR} out=gr${DATASET}clip_${REFYEAR} -r


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

Hm...This is a bit confusing. The code below will load data, but it will load geom_1 instead of geom_2, i.e. it seems to ignore the geomfield definition. Tested in quotes 'geom_2', but no change. If run the code for geom_1, the spatial limitation gets respected.

ogr2ogr -spat 2653156, 1249949, 2675000, 1267232 -geomfield geom_2 -f GPKG test.gpkg PG:"dbname=psql_local" ${DBSCHEMA}.${DATASET}

On 26/02/2019 21.39, Markus Metz wrote:

ogr2ogr -spat 2653156, 1249949, 2675000, 1267232 -geomfield geom_2 -f GPKG test.gpkg "PG:dbname=psql_local" layer ${DBSCHEMA}.${DATASET}

On Tue, Feb 26, 2019 at 9:39 PM Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Tue, Feb 26, 2019 at 9:17 PM patrick_s <patrick_GIS@gmx.net> wrote:

Thanks Markus

My GRASS-version is 7.4 from standard Ubuntu 18.04.2 LTS repository;

This should work as expected. AFAICT, the spatial option and the -r flag are properly passed to OGR.

Hmm, no, if the geometry option is given, the spatial filter was not properly passed to OGR. Hopefully fixed in trunk r74137.

Markus M

Are there any warnings or errors in the output messages of v.in.ogr?

In order to help testing, you could use OGR directly to extract a spatial subset:

ogr2ogr -spat 2653156, 1249949, 2675000, 1267232 -geomfield geom_2 -f GPKG test.gpkg “PG:dbname=psql_local” layer ${DBSCHEMA}.${DATASET}

and test if you get the expected result.

The arguments for ogr2ogr are derived from your information and untested.

Markus M

Regards,

Patrick

On 26/02/2019 21.12, Markus Metz wrote:

On Tue, Feb 26, 2019 at 5:05 PM patrick_s <patrick_GIS@gmx.net> wrote:

Dear list

The syntax of v.in.ogr ignores the “geometry” Parameter, when using the
“spatial” Parameter or “-r”. A workaround is the use of v.clip and g.rename.

I am a longterm user, but unregular user and have no userid to start a
ticket. Hope this helps for future development nontheless.

Of course it helps! Which GRASS version are you using? v.in.ogr has changed quite a bit recently, therefore we recommend to use GRASS 7.6.

Best,

Markus M

Best,

Patrick

#using flag “-r” and “spatial” finds “2990 vertices registered”

v.in.ogr spatial=“2653156, 1249949, 2675000, 1267232”
input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o

v.in.ogr -r input=“PG:dbname=psql_local” layer=${DBSCHEMA}.${DATASET}
out=gr_${DATASET}_${REFYEAR} type=point geometry=“geom_2” -o --o #2990
vertices registered

#clipping with same region after loading reduces to “1079 primitives
registered”

v.clip in=gr_${DATASET}${REFYEAR} out=gr${DATASET}clip_${REFYEAR} -r


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