[GRASS-user] v.external to layer in PostGIS database

Nikos Alexandris nik at nikosalexandris.net
Thu May 3 10:57:17 PDT 2018


Dear (PostGIS) data base experts,

trying to connect to an external, non-local, PostGIS layer via `v.external`,
`db.connect -p` shows all is set. Testing via `db.test test="test1"`
works fine, I think:

```
Using DB driver: pg
CREATE TABLE grass_test1 (i1 INTEGER, d1 DOUBLE PRECISION, c1 VARCHAR(20))
EXECUTE: OK
INSERT INTO grass_test1 VALUES ( 1, 123.456, 'abcd' )
EXECUTE: OK
INSERT INTO grass_test1 VALUES ( 2, null, 'xxx' )
EXECUTE: OK
SELECT * FROM grass_test1
EXECUTE: OK
RESULT: OK
SELECT c1 FROM grass_test1 WHERE d1 < 500 / 2 AND i1 <> 2  AND c1 LIKE '%bc%'
EXECUTE: OK
RESULT: OK
INSERT INTO grass_test1 VALUES ( 3, 0.0, '_\''_' )
EXECUTE: OK
ALTER TABLE grass_test1 ADD COLUMN i2 INTEGER
EXECUTE: OK
UPDATE grass_test1 SET d1 = 18.6, i2 = 987  WHERE i1 = 2
EXECUTE: OK
SELECT * FROM grass_test1
EXECUTE: OK
2d1
< 3|0|_\\'_|
3a3
> 3|0|_\'_|
ERROR: RESULT: ******** ERROR ********
DROP TABLE grass_test1
EXECUTE: OK
```

What is this "ERROR" about?

Executing
```
v.external in=PG:dbname=SomeName layer="pa.pa_1000" out=test
```

reports only warnings:
```
WARNING: No key column detected.
WARNING: Feature table <pa_1000> has no primary key defined. Unable to define
  DB links.
..
WARNING: Random read is not supported for this layer. Unable to build
topology.
v.external complete. Link to vector map <test> created.
```

Is this an "indexing" issue on the PG side?


What is wanted, actually, is to link to "external" layers, stored in a
PostGIS data base and, subsequently, run `g.region` and `r.mask
vector=LinkedLayer`. I have tried this steps using an external ESRI
Shapefile, and it works. Would a PG "layer" be a problem?

Thank you, Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180503/9a978625/attachment.sig>


More information about the grass-user mailing list