[GRASS-dev] Export from GRASS to Postgres

Hi All,

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area ‘dsn=PG:host=localhost dbname=grass user=grassuser password=grassuser’ olayer=fields2postgis layer=1 format=PostgreSQL
The database grass is postgis enabled.
However the format “PostgreSQL” is taken as invalid format.
Without “PostgreSql” format the maps are exported to ESRI_shapefile format.
One thing more, There is no PostgreSql format type in OGR format dropdown list in case of using GUI.
Please help me out.

Thanks in advance.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash

Hi,

2013/4/3 suprakash maitra <suprakashmaitra@yahoo.com>:

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of
installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area 'dsn=PG:host=localhost dbname=grass
user=grassuser password=grassuser' olayer=fields2postgis layer=1
format=PostgreSQL

`v.out.ogr` is using OGR library. In other words, GRASS must be
compiled with OGR support and your OGR installation must be compiled
with PostgreSQL support. Check available formats with

$ ogrinfo --formats | grep PostgreSQL
  -> "PostgreSQL" (read/write)

then v.out.ogr comes also with `format=PostgreSQL`.

In GRASS 7 you could try also a new module `v.out.postgis` which
allows to export GRASS vector maps to PostGIS without OGR library
(GRASS must be compiled with PostgreSQL support). This module also
allows to export vector data to PostGIS Topology [1] (under
development).

Martin

[1] http://grasswiki.osgeo.org/wiki/PostGIS_Topology

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

[again - please keep communication on ML!]

2013/4/4 suprakash maitra <suprakashmaitra@yahoo.com>:

v.out.ogr -c input=fields type=area dsn='PG:host=localhost dbname=grass
user=grassuser password=grassuser' olayer=fields2postgis layer=1
format=PostgreSQL
ERROR: value <PostgreSQL> out of range for parameter
<format>

as I mentioned earlier, your GDAL/OGR must be compiled with PostgreSQl
support [1].

Martin

[1] http://gdal.org/ogr/drv_pg.html

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

[please don't send me private mails, keep the communication on ML,
please don't ignore it!]

2013/4/5 suprakash maitra <suprakashmaitra@yahoo.com>:

[root@lab35 grass-6.4.2]#./configure
--with-postgres-includes=/opt/PostgreSQL/9.1/include
--with-postgres-libs=/opt/PostgreSQL/9.1/lib
--with-freetype-includes=/usr/include/freetype2
--with-freetype-libs=/usr/lib --with-cxx --with-python --with-fftw
--with-freetype --with-gdal=/usr/local/bin/gdal-config --with-postgres

GRASS is installed and configured with postgres

As I noted *earlier*, v.out.ogr is using OGR library to export data to
PostgreSQL/PostGIS. So it's not related to this problem.

then
[root@lab35 gdal-1.8.1]#./configure
--with-grass=/usr/local/grass-6.4.2/dist.i686-pc-linux-gnu
--with-libgrass=/usr/local/grass-6.4.2/dist.i686-pc-linux-gnu/lib
--with-pg=/opt/PostgreSQL/9.1/bin/pg_config

gdal is configured with grass and postgres

You don't need to compile GDAL with GRASS support, unless you want use
OGR GRASS driver [1]. None of r.[in|out].gdal and v.[in|out].ogr
modules do not use this driver.

after that I have got the output with the command:

$ ogrinfo --formats | grep PostgreSQL
  -> "PostgreSQL" (read/write)

Even then the format "PostgreSQL" is not supported.

Are you sure that you compile GRASS against the same GDAL/OGR version.
It could be that you have more GDAL/OGR installations on your machine.

Martin

[1] http://gdal.org/ogr/drv_grass.html

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi
I am using Fedora15,GRASS-6.4.2,gdal-1.8.1,postgresql-9.1.I have compiled gdal with postgresql support and GRASS with gdal and postgreSQL support ,even then while exporting map/mapset to postgreSQL the format PostgreSQL is not supported.

Plz help me out.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Wednesday, April 3, 2013 5:44 PM
Subject: Export from GRASS to Postgres

Hi All,

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area ‘dsn=PG:host=localhost dbname=grass user=grassuser password=grassuser’ olayer=fields2postgis layer=1 format=PostgreSQL
The database grass is postgis enabled.
However the format “PostgreSQL” is taken as invalid format.
Without “PostgreSql” format the maps are exported to ESRI_shapefile format.
One thing more, There is no PostgreSql format type in OGR format dropdown list in case of using GUI.
Please help me out.

Thanks in advance.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash

On 08/04/13 12:30, suprakash maitra wrote:

Hi
I am using Fedora15,GRASS-6.4.2,gdal-1.8.1,postgresql-9.1.I have
compiled gdal with postgresql support and GRASS with gdal and postgreSQL
support ,even then while exporting map/mapset to postgreSQL the format
PostgreSQL is not supported.

Plz help me out.

Can you check the outputs of:

v.in.ogr -f

and

ogrinfo --formats

?

Hi,
v.in.ogr -f
ESRI Shapefile (rw): ESRI Shapefile
MapInfo File (rw): MapInfo File
UK .NTF (ro): UK .NTF
SDTS (ro): SDTS
TIGER (rw): TIGER
S57 (rw): S57
DGN (rw): DGN
VRT (ro): VRT
REC (ro): REC
Memory (rw): Memory
BNA (rw): BNA
CSV (rw): CSV
GML (rw): GML
GPX (rw): GPX
KML (rw): KML
GeoJSON (rw): GeoJSON
GMT (rw): GMT
SQLite (rw): SQLite
PCIDSK (rw): PCIDSK
XPlane (ro): XPlane
AVCBin (ro): AVCBin
AVCE00 (ro): AVCE00
DXF (rw): DXF
Geoconcept (rw): Geoconcept
GeoRSS (rw): GeoRSS
GPSTrackMaker (rw): GPSTrackMaker
VFK (ro): VFK
PGDump (rw): PGDump
GPSBabel (rw): GPSBabel
SUA (ro): SUA
OpenAir (ro): OpenAir
PDS (ro): PDS
WFS (ro): WFS
HTF (ro): HTF
AeronavFAA (ro): AeronavFAA
Available OGR Drivers:
(Mon Apr 8 18:17:56 2013) Command finished (0 sec)
[user@lab35 local]$ ogrinfo --formats
Supported Formats:
→ “ESRI Shapefile” (read/write)
→ “MapInfo File” (read/write)
→ “UK .NTF” (readonly)
→ “SDTS” (readonly)
→ “TIGER” (read/write)
→ “S57” (read/write)
→ “DGN” (read/write)
→ “VRT” (readonly)
→ “REC” (readonly)
→ “Memory” (read/write)
→ “BNA” (read/write)
→ “CSV” (read/write)
→ “GML” (read/write)
→ “GPX” (read/write)
→ “KML” (read/write)
→ “GeoJSON” (read/write)
→ “GMT” (read/write)
→ “SQLite” (read/write)
→ “PostgreSQL” (read/write)
→ “PCIDSK” (read/write)
→ “XPlane” (readonly)
→ “AVCBin” (readonly)
→ “AVCE00” (readonly)
→ “DXF” (read/write)
→ “Geoconcept” (read/write)
→ “GeoRSS” (read/write)
→ “GPSTrackMaker” (read/write)
→ “VFK” (readonly)
→ “PGDump” (read/write)
→ “GPSBabel” (read/write)
→ “SUA” (readonly)
→ “OpenAir” (readonly)
→ “PDS” (readonly)
→ “WFS” (readonly)
→ “HTF” (readonly)
→ “AeronavFAA” (readonly)


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Monday, April 8, 2013 4:00 PM
Subject: Re: Export from GRASS to Postgres

Hi
I am using Fedora15,GRASS-6.4.2,gdal-1.8.1,postgresql-9.1.I have compiled gdal with postgresql support and GRASS with gdal and postgreSQL support ,even then while exporting map/mapset to postgreSQL the format PostgreSQL is not supported.

Plz help me out.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Wednesday, April 3, 2013 5:44 PM
Subject: Export from GRASS to Postgres

Hi All,

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area ‘dsn=PG:host=localhost dbname=grass user=grassuser password=grassuser’ olayer=fields2postgis layer=1 format=PostgreSQL
The database grass is postgis enabled.
However the format “PostgreSQL” is taken as invalid format.
Without “PostgreSql” format the maps are exported to ESRI_shapefile format.
One thing more, There is no PostgreSql format type in OGR format dropdown list in case of using GUI.
Please help me out.

Thanks in advance.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash

2013/4/8 suprakash maitra <suprakashmaitra@yahoo.com>:

  -> "PostgreSQL" (read/write)

then GRASS is probably using different GDAL library which is built
without PostgreSQL. Check if there are more GDAL installations on your
machine. See the previous answer.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

2013/4/8 Martin Landa <landa.martin@gmail.com>:

2013/4/8 suprakash maitra <suprakashmaitra@yahoo.com>:

  -> "PostgreSQL" (read/write)

then GRASS is probably using different GDAL library which is built
without PostgreSQL. Check if there are more GDAL installations on your
machine. See the previous answer.

in other words, what says?

ogrinfo --version

gdal-config --libs

g.version -e (in GRASS 7)

or

g.version -b (in GRASS 6)

Martin

--

Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi
You have given some commands,on the basis of that o/p is as follows:

[user@lab35 ~]$ ogrinfo --version
GDAL 1.8.1, released 2011/07/09
[user@lab35 ~]$ gdal-config --libs
-L/usr/local/lib -lgdal
[user@lab35 ~]$

g.version -b (in GRASS 6)
./configure --with-postgres-includes=/opt/PostgreSQL/9.1/include --with-postgres-libs=/opt/PostgreSQL/9.1/lib --with-freetype-includes=/usr/include/freetype2 --with-freetype-libs=/usr/lib --with-cxx --with-python --with-fftw --with-freetype --with-gdal=/usr/local/bin/gdal-config --with-postgres

according to you there is a different GDAL library,
then how can check it or what should I do with it,to get things done.

Thanks in advance


“If you don’t know where you are going any road will get you there”

Regards

suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Monday, April 8, 2013 6:21 PM
Subject: Re: Export from GRASS to Postgres

Hi,
v.in.ogr -f
ESRI Shapefile (rw): ESRI Shapefile
MapInfo File (rw): MapInfo File
UK .NTF (ro): UK .NTF
SDTS (ro): SDTS
TIGER (rw): TIGER
S57 (rw): S57
DGN (rw): DGN
VRT (ro): VRT
REC (ro): REC
Memory (rw): Memory
BNA (rw): BNA
CSV (rw): CSV
GML (rw): GML
GPX (rw): GPX
KML (rw): KML
GeoJSON (rw): GeoJSON
GMT (rw): GMT
SQLite (rw): SQLite
PCIDSK (rw): PCIDSK
XPlane (ro): XPlane
AVCBin (ro): AVCBin
AVCE00 (ro): AVCE00
DXF (rw): DXF
Geoconcept (rw): Geoconcept
GeoRSS (rw): GeoRSS
GPSTrackMaker (rw): GPSTrackMaker
VFK (ro): VFK
PGDump (rw): PGDump
GPSBabel (rw): GPSBabel
SUA (ro): SUA
OpenAir (ro): OpenAir
PDS (ro): PDS
WFS (ro): WFS
HTF (ro): HTF
AeronavFAA (ro): AeronavFAA
Available OGR Drivers:
(Mon Apr 8 18:17:56 2013) Command finished (0 sec)
[user@lab35 local]$ ogrinfo --formats
Supported Formats:
→ “ESRI Shapefile” (read/write)
→ “MapInfo File” (read/write)
→ “UK .NTF” (readonly)
→ “SDTS” (readonly)
→ “TIGER” (read/write)
→ “S57” (read/write)
→ “DGN” (read/write)
→ “VRT” (readonly)
→ “REC” (readonly)
→ “Memory” (read/write)
→ “BNA” (read/write)
→ “CSV” (read/write)
→ “GML” (read/write)
→ “GPX” (read/write)
→ “KML” (read/write)
→ “GeoJSON” (read/write)
→ “GMT” (read/write)
→ “SQLite” (read/write)
→ “PostgreSQL” (read/write)
→ “PCIDSK” (read/write)
→ “XPlane” (readonly)
→ “AVCBin” (readonly)
→ “AVCE00” (readonly)
→ “DXF” (read/write)
→ “Geoconcept” (read/write)
→ “GeoRSS” (read/write)
→ “GPSTrackMaker” (read/write)
→ “VFK” (readonly)
→ “PGDump” (read/write)
→ “GPSBabel” (read/write)
→ “SUA” (readonly)
→ “OpenAir” (readonly)
→ “PDS” (readonly)
→ “WFS” (readonly)
→ “HTF” (readonly)
→ “AeronavFAA” (readonly)


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Monday, April 8, 2013 4:00 PM
Subject: Re: Export from GRASS to Postgres

Hi
I am using Fedora15,GRASS-6.4.2,gdal-1.8.1,postgresql-9.1.I have compiled gdal with postgresql support and GRASS with gdal and postgreSQL support ,even then while exporting map/mapset to postgreSQL the format PostgreSQL is not supported.

Plz help me out.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Wednesday, April 3, 2013 5:44 PM
Subject: Export from GRASS to Postgres

Hi All,

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area ‘dsn=PG:host=localhost dbname=grass user=grassuser password=grassuser’ olayer=fields2postgis layer=1 format=PostgreSQL
The database grass is postgis enabled.
However the format “PostgreSQL” is taken as invalid format.
Without “PostgreSql” format the maps are exported to ESRI_shapefile format.
One thing more, There is no PostgreSql format type in OGR format dropdown list in case of using GUI.
Please help me out.

Thanks in advance.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash

Hi,

2013/4/9 suprakash maitra <suprakashmaitra@yahoo.com>:

[user@lab35 ~]$ gdal-config --libs
-L/usr/local/lib -lgdal

and what says?

$ which gdal-config

g.version -b (in GRASS 6)
./configure --with-postgres-includes=/opt/PostgreSQL/9.1/include
--with-postgres-libs=/opt/PostgreSQL/9.1/lib
--with-freetype-includes=/usr/include/freetype2
--with-freetype-libs=/usr/lib --with-cxx --with-python --with-fftw
--with-freetype --with-gdal=/usr/local/bin/gdal-config --with-postgres

is PostgreSQL included in

/usr/local/bin/ogrinfo --formats

?

Seems like that you have two GDAL installations (in /usr and /usr/local).

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,
$ which gdal-config
/usr/local/bin/gdal-config
and version is:CONFIG_VERSION=“1.8.1”
is PostgreSQL included in

/usr/local/bin/ogrinfo --formats

[user@lab35 local]$ /usr/local/bin/ogrinfo --formats
Supported Formats:
→ “ESRI Shapefile” (read/write)
→ “MapInfo File” (read/write)
→ “UK .NTF” (readonly)
→ “SDTS” (readonly)
→ “TIGER” (read/write)
→ “S57” (read/write)
→ “DGN” (read/write)
→ “VRT” (readonly)
→ “REC” (readonly)
→ “Memory” (read/write)
→ “BNA” (read/write)
→ “CSV” (read/write)
→ “GML” (read/write)
→ “GPX” (read/write)
→ “KML” (read/write)
→ “GeoJSON” (read/write)
→ “GMT” (read/write)
→ “SQLite” (read/write)
→ “PostgreSQL” (read/write)
→ “PCIDSK” (read/write)
→ “XPlane” (readonly)
→ “AVCBin” (readonly)

then what to do?


“If you don’t know where you are going any road will get you there”

Regards

suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Tuesday, April 9, 2013 1:32 PM
Subject: Re: Export from GRASS to Postgres

Hi
You have given some commands,on the basis of that o/p is as follows:

[user@lab35 ~]$ ogrinfo --version
GDAL 1.8.1, released 2011/07/09
[user@lab35 ~]$ gdal-config --libs
-L/usr/local/lib -lgdal
[user@lab35 ~]$

g.version -b (in GRASS 6)
./configure --with-postgres-includes=/opt/PostgreSQL/9.1/include --with-postgres-libs=/opt/PostgreSQL/9.1/lib --with-freetype-includes=/usr/include/freetype2 --with-freetype-libs=/usr/lib --with-cxx --with-python --with-fftw --with-freetype --with-gdal=/usr/local/bin/gdal-config --with-postgres

according to you there is a different GDAL library,
then how can check it or what should I do with it,to get things done.

Thanks in advance


“If you don’t know where you are going any road will get you there”

Regards

suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Monday, April 8, 2013 6:21 PM
Subject: Re: Export from GRASS to Postgres

Hi,
v.in.ogr -f
ESRI Shapefile (rw): ESRI Shapefile
MapInfo File (rw): MapInfo File
UK .NTF (ro): UK .NTF
SDTS (ro): SDTS
TIGER (rw): TIGER
S57 (rw): S57
DGN (rw): DGN
VRT (ro): VRT
REC (ro): REC
Memory (rw): Memory
BNA (rw): BNA
CSV (rw): CSV
GML (rw): GML
GPX (rw): GPX
KML (rw): KML
GeoJSON (rw): GeoJSON
GMT (rw): GMT
SQLite (rw): SQLite
PCIDSK (rw): PCIDSK
XPlane (ro): XPlane
AVCBin (ro): AVCBin
AVCE00 (ro): AVCE00
DXF (rw): DXF
Geoconcept (rw): Geoconcept
GeoRSS (rw): GeoRSS
GPSTrackMaker (rw): GPSTrackMaker
VFK (ro): VFK
PGDump (rw): PGDump
GPSBabel (rw): GPSBabel
SUA (ro): SUA
OpenAir (ro): OpenAir
PDS (ro): PDS
WFS (ro): WFS
HTF (ro): HTF
AeronavFAA (ro): AeronavFAA
Available OGR Drivers:
(Mon Apr 8 18:17:56 2013) Command finished (0 sec)
[user@lab35 local]$ ogrinfo --formats
Supported Formats:
→ “ESRI Shapefile” (read/write)
→ “MapInfo File” (read/write)
→ “UK .NTF” (readonly)
→ “SDTS” (readonly)
→ “TIGER” (read/write)
→ “S57” (read/write)
→ “DGN” (read/write)
→ “VRT” (readonly)
→ “REC” (readonly)
→ “Memory” (read/write)
→ “BNA” (read/write)
→ “CSV” (read/write)
→ “GML” (read/write)
→ “GPX” (read/write)
→ “KML” (read/write)
→ “GeoJSON” (read/write)
→ “GMT” (read/write)
→ “SQLite” (read/write)
→ “PostgreSQL” (read/write)
→ “PCIDSK” (read/write)
→ “XPlane” (readonly)
→ “AVCBin” (readonly)
→ “AVCE00” (readonly)
→ “DXF” (read/write)
→ “Geoconcept” (read/write)
→ “GeoRSS” (read/write)
→ “GPSTrackMaker” (read/write)
→ “VFK” (readonly)
→ “PGDump” (read/write)
→ “GPSBabel” (read/write)
→ “SUA” (readonly)
→ “OpenAir” (readonly)
→ “PDS” (readonly)
→ “WFS” (readonly)
→ “HTF” (readonly)
→ “AeronavFAA” (readonly)


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Monday, April 8, 2013 4:00 PM
Subject: Re: Export from GRASS to Postgres

Hi
I am using Fedora15,GRASS-6.4.2,gdal-1.8.1,postgresql-9.1.I have compiled gdal with postgresql support and GRASS with gdal and postgreSQL support ,even then while exporting map/mapset to postgreSQL the format PostgreSQL is not supported.

Plz help me out.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash


From: suprakash maitra suprakashmaitra@yahoo.com
To:grass-dev@lists.osgeo.orggrass-dev@lists.osgeo.org
Sent: Wednesday, April 3, 2013 5:44 PM
Subject: Export from GRASS to Postgres

Hi All,

I am trying to export GRASS maps/mapsets to PostgreSQL.At the time of installation of GRASS ,I have configured it with Postgres.
The command used is:
v.out.ogr -c input=fields type=area ‘dsn=PG:host=localhost dbname=grass user=grassuser password=grassuser’ olayer=fields2postgis layer=1 format=PostgreSQL
The database grass is postgis enabled.
However the format “PostgreSQL” is taken as invalid format.
Without “PostgreSql” format the maps are exported to ESRI_shapefile format.
One thing more, There is no PostgreSql format type in OGR format dropdown list in case of using GUI.
Please help me out.

Thanks in advance.


“If you don’t know where you are going any road will get you there”

Regards

Suprakash