AW: Re: [GRASS-user] v.in.ogr doesn't support Postgres Data Type timestamp

Marcus,

Now it works! Thank you very much.

But during testing I’m running into the next problem of schma support. When I load a layer from schema different to public the schema support works fine. But when I load a layer residing in public schema with “public.

” v.in.ogr is not able to load this layer. GRASS responses with:

“Layer ‘public.

’ is not available”

GRASS 6.2-cvs

Best Regards
Horst


Dr. Horst Düster
GIS-Koordinator, Stv. Amtschef

Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn

Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14

mailto:horst.duester@bd.so.ch
http://www.agi.so.ch

-----Ursprüngliche Nachricht-----
Von: Markus Neteler [mailto:neteler@fbk.eu]
Gesendet am: Samstag, 24. November 2007 14:44
An: Düster Horst
Cc: grass-user
Betreff: Re: [GRASS-user] v.in.ogr doesn’t support Postgres Data Type
timestamp

Confirmed for 6.2.2. It works in 6.3.x.

The complete test sequence is:

CREATE TABLE test
(
id serial NOT NULL,
mytime timestamp DEFAULT now(),
text varchar,
wkb_geometry geometry,
CONSTRAINT test_pkey PRIMARY KEY (id)
)
WITHOUT OIDS;

INSERT INTO test (text, wkb_geometry)
VALUES (‘Name’,geometryFromText(‘POLYGON((600000 200000,650000
200000,650000 250000,600000 250000,600000 200000))’,-1));

this was missing in below example:

select AddGeometryColumn (‘postgis’, ‘test’, ‘geometry’, -1, ‘GEOMETRY’, 2);

import

v.in.ogr dsn=“PG:host=localhost dbname=postgis user=neteler” layer=test
output=test type=boundary,centroid

I have now backported a set of changes:

  • PG driver: PG_TYPE_POSTGIS_GEOM and views backported
  • v.in.ogr: OFTDate, OFTTime and OFTDateTime backported

It now works:
v.db.select test
cat|id|mytime|text
1|1|2007-11-24 13:03:49|Name

To avoid another 6.2.3 release candidate, please download
http://grass.itc.it/grass62/source/snapshot/
→ grass-6.2.cvs_src_snapshot_2007_11_24.tar.gz

and give it a try. I have created the snapshot again to
include these changes.

Markus

On Fri, Nov 23, 2007 at 02:40:44PM +0100, Düster Horst wrote:

v.in.ogr v.in.ogr doesn’t support Postgres Data Type timestamp. When you
try to import PostGIS layer with columns of type timestamp v.in.ogr
reports the error p.e.:
table xxx has 4 columns 6 values were supplied
This example error happens when table xxx hat 2 colums of 6 columns with
type timestamp. It seems that v.in.ogr detects the wrong number of
columns.Isn’t is possible to convert timestamp data to character data?
Regards
Horst

Dr. Horst Duester
GIS-Koordinator, Stv. Amtschef
Kanton Solothurn
Bau- und Justizdepartement
Amt fuer Geoinformation
SO!GIS Koordination
Roetistrasse 4
CH-4501 Solothurn
Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14
mailto:horst.duester@bd.so.ch
http://www.agi.so.ch

Content-Description: ATT00001


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


Markus Neteler http://mpa.fbk.eu/markus/
FBK-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy
New book: http://www.grassbook.org/

Horst,

could you please try 'ogrinfo' on the layer to see
if plain OGR sees it? From looking at the code I
don't see a reason that a 'public' schema should
fail.

Best,
Markus

PS: I still hold 6.2.3 unless this is sorted out.

Düster Horst wrote on 11/26/2007 10:56 AM:

Marcus,

Now it works! Thank you very much.

But during testing I'm running into the next problem of schma support.
When I load a layer from schema different to public the schema support
works fine. But when I load a layer residing in public schema with
"public.<table>" v.in.ogr is not able to load this layer. GRASS
responses with:

"Layer 'public.<table>' is not available"

GRASS 6.2-cvs

Best Regards
Horst

------------------------------------------------

Dr. Horst Düster
GIS-Koordinator, Stv. Amtschef

Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn

Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14

mailto:horst.duester@bd.so.ch
http://www.agi.so.ch

-----Ursprüngliche Nachricht-----
Von: Markus Neteler [mailto:neteler@fbk.eu]
Gesendet am: Samstag, 24. November 2007 14:44
An: Düster Horst
Cc: grass-user
Betreff: Re: [GRASS-user] v.in.ogr doesn't support Postgres Data Type
timestamp

Confirmed for 6.2.2. It works in 6.3.x.

The complete test sequence is:

CREATE TABLE test
(
id serial NOT NULL,
mytime timestamp DEFAULT now(),
text varchar,
wkb_geometry geometry,
CONSTRAINT test_pkey PRIMARY KEY (id)
)
WITHOUT OIDS;

INSERT INTO test (text, wkb_geometry)
VALUES ('Name',geometryFromText('POLYGON((600000 200000,650000
200000,650000 250000,600000 250000,600000 200000))',-1));

# this was missing in below example:
select AddGeometryColumn ('postgis', 'test', 'geometry', -1,
'GEOMETRY', 2);

# import
v.in.ogr dsn="PG:host=localhost dbname=postgis user=neteler" layer=test \
output=test type=boundary,centroid

I have now backported a set of changes:
- PG driver: PG_TYPE_POSTGIS_GEOM and views backported
- v.in.ogr: OFTDate, OFTTime and OFTDateTime backported

It now works:
v.db.select test
cat|id|mytime|text
1|1|2007-11-24 13:03:49|Name

To avoid another 6.2.3 release candidate, please download
http://grass.itc.it/grass62/source/snapshot/
-> grass-6.2.cvs_src_snapshot_2007_11_24.tar.gz

and give it a try. I have created the snapshot again to
include these changes.

Markus

On Fri, Nov 23, 2007 at 02:40:44PM +0100, Düster Horst wrote:
> v.in.ogr v.in.ogr doesn't support Postgres Data Type timestamp. When you
> try to import PostGIS layer with columns of type timestamp v.in.ogr
> reports the error p.e.:
> table xxx has 4 columns 6 values were supplied
> This example error happens when table xxx hat 2 colums of 6 columns with
> type timestamp. It seems that v.in.ogr detects the wrong number of
> columns.Isn't is possible to convert timestamp data to character data?
> Regards
> Horst
> ------------------------------------------------
> Dr. Horst Duester
> GIS-Koordinator, Stv. Amtschef
> Kanton Solothurn
> Bau- und Justizdepartement
> Amt fuer Geoinformation
> SO!GIS Koordination
> Roetistrasse 4
> CH-4501 Solothurn
> Telefon ++41(0)32 627 25 32
> Telefax ++41(0)32 627 22 14
> mailto:horst.duester@bd.so.ch
> http://www.agi.so.ch