v.external: mixed up IDs from PostGIS tables
|Reported by:||sbl||Owned by:|
Description (last modified by )
I tried to link a PostGIS table to GRASS GIS 7 for point sampling using v.external (in GRASS 7.0.6 and GRASS 7.2.1svn).
With that linked layer (which is not in public schema and has column "point_id" as primary key) I get a lot of:
WARNING: No record for category XXXX in table <myschema.points>
when I use v.what.rast on that layer.
The results suggest that not the proper IDs were used when values were loaded to attribute table. Because values in the attribute table of the points do not match with values in the raster at point locations. Furthermore, some points, which are supposed to have values in the attribute table, have none...
With the attaced data, the issue can be reproduced like this:
ogr2ogr -f PostgreSQL "PG:dbname=gisdata schemas=myschema" points.sqlite points v.external --overwrite input=PG:dbname=gisdata layer=points output=points_pg -o g.region -p -a vector=points_pg res=250 r.random.surface --overwrite --verbose output=rand v.what.rast map=points_pg raster=rand column=morphology
Linking the SQLite data source however seems to work fine. No errors for:
v.external --overwrite input=points.sqlite layer=myschema.points output=points_sqlite -o v.what.rast map=points_sqlite raster=rand column=morphology
This is my PostGIS / GRASS environment:
PostgreSQL 9.5.2 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit POSTGIS="2.2.2 r14797" GEOS="3.5.1-CAPI-1.9.1 r4171" SFCGAL="1.3.0" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 2.0.3, released 2016/07/01"
For discussion see: https://lists.osgeo.org/pipermail/grass-dev/2017-January/083807.html