[GRASS-user] ogr-grass

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.
We're experimenting with the ogr driver for grass vector (just entered
into Debian unstable - thanks Steve Halasz!). Everything works well 8eg
ogr2ogr), but we cannot figure out how to pass the PostgreSQL connection
string through MapServer. AFAICT, mapserver works as www-data user, and
rough attempts to give these credential to www-data (copying
.grasslogin6 in /home/www-data) had no success (DBMI-Postgres driver
error: Cannot connect to Postgres: fe_sendauth: no password supplied).
With dbf driver everything is ok.
Anybody has a hint?
All the best.
pc
- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEorK//NedwLUzIr4RAl/iAJwLsH15ivHb2t7CmoXW+bbPoI7AKgCdEsf+
b1KYyL5ZFWqnZUM2oXdsoc4=
=Aqpf
-----END PGP SIGNATURE-----

Hallo

is http://mapserver.gis.umn.edu/docs/reference/vector_data/postgis what
you are searching for?

LAYER
    NAME pg_test
    TYPE POLYGON
    CONNECTIONTYPE POSTGIS
    CONNECTION "host=yourhostname dbname=yourdatabasename user=yourdbusername password=yourdbpassword port=yourpgport"
    DATA "wkb_geometry FROM province"
    CLASS
        ...
    END
END

Jáchym

On Wed, Jun 28, 2006 at 06:47:59PM +0200, Paolo Cavallini wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.
We're experimenting with the ogr driver for grass vector (just entered
into Debian unstable - thanks Steve Halasz!). Everything works well 8eg
ogr2ogr), but we cannot figure out how to pass the PostgreSQL connection
string through MapServer. AFAICT, mapserver works as www-data user, and
rough attempts to give these credential to www-data (copying
.grasslogin6 in /home/www-data) had no success (DBMI-Postgres driver
error: Cannot connect to Postgres: fe_sendauth: no password supplied).
With dbf driver everything is ok.
Anybody has a hint?
All the best.
pc
- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEorK//NedwLUzIr4RAl/iAJwLsH15ivHb2t7CmoXW+bbPoI7AKgCdEsf+
b1KYyL5ZFWqnZUM2oXdsoc4=
=Aqpf
-----END PGP SIGNATURE-----

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
GDF-Hannover
Mengendamm 16d
30177 Hannover
Germany
e-mail: cepicky@gdf-hannover.de
URL: http://gdf-hannover.de
Tel.: +49 511-39088507

Hello Paolo,

On Wed, 28 Jun 2006 18:47:59 +0200 Paolo Cavallini
<cavallini@faunalia.it> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.
We're experimenting with the ogr driver for grass vector (just entered
into Debian unstable - thanks Steve Halasz!). Everything works well
8eg ogr2ogr), but we cannot figure out how to pass the PostgreSQL
connection string through MapServer. AFAICT, mapserver works as
www-data user, and rough attempts to give these credential to
www-data (copying .grasslogin6 in /home/www-data) had no success
(DBMI-Postgres driver error: Cannot connect to Postgres: fe_sendauth:
no password supplied). With dbf driver everything is ok.
Anybody has a hint?

you are going to access GRASS-data with postgressql-stored attributes
through mapserver?
Perhaps you need to do db.login as www-data first to create the needed
dot-files?!

Just another thought:
Does the user www-data have rights to access to postgresql at all? Did
you try with psql -U www-data <yourdb>? Does it work?

Hope this helps

  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stephen.
In fact, www-data accesses the db; it does not seem able to use the
.grasslogin6.
Anybody has a hint?
Many thanks.
pc

Stephan Holl wrote:

Hello Paolo,

you are going to access GRASS-data with postgressql-stored attributes
through mapserver?
Perhaps you need to do db.login as www-data first to create the needed
dot-files?!

Just another thought:
Does the user www-data have rights to access to postgresql at all? Did
you try with psql -U www-data <yourdb>? Does it work?

Hope this helps

  Stephan

- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpN+u/NedwLUzIr4RAtWgAJ93NZOqsw8kWaCPuVbe0bMez3r6DACgrN3Z
m1pP5dDW3Ksfxx18RZ0uh2Y=
=DBoV
-----END PGP SIGNATURE-----

Hello Paolo,

On Fri, 30 Jun 2006 10:24:14 +0200 Paolo Cavallini
<cavallini@faunalia.it> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stephen.
In fact, www-data accesses the db; it does not seem able to use the
.grasslogin6.
Anybody has a hint?
Many thanks.
pc

have you set the HOME variable for user www-data using apaches
SetEnv-stuff in apache.conf?

Perhaps this might help?

Best
  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Further testing.
Now www-data can do whatherver with ogr, eg.
ogrinfo -so -where atc_num=13
/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head 1

gives:

Layer name: 1
Geometry: Polygon
Feature Count: 18
Extent: (1554732.664063, 4678313.000000) - (1771665.406250, 4924775.960937)
Layer SRS WKT:
PROJCS["Transverse Mercator",
    GEOGCS["international",
        DATUM["Monte_Mario",
...

but if we use a string, eg
ogrinfo -so -where nomemin='lucca'
/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head 1

we get:

Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
/usr/lib/grass
INFO: Open of
`/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head'
using driver `GRASS' successful.
DBMI-Postgres driver error:
Cannot select:
SELECT * FROM t_comuni_2003 WHERE nomemin=lucca ORDER BY cat
ERROR: la colonna "lucca" non esiste

ERROR 1: Cannot open cursor.

Layer name: 1
Geometry: Polygon
Feature Count: 313
Extent: (1554732.664063, 4678313.000000) - (1771665.406250, 4924775.960937)
Layer SRS WKT:
PROJCS["Transverse Mercator",
    GEOGCS["international",
        DATUM["Monte_Mario",
...

as we can see, there is an error with the database connection (possibly
due to the removal of ' ?)

Maybe related to this, mapserver cannot connect to the DB; grass layers
are loaded and shown, but if we try connecting to PostgreSQL (e.g.
LABELITEM, EXPRESSION...) we get an errore:

[Mon Jul 03 18:15:45 2006] [error] [client 192.168.0.110] PHP Warning:
[MapServer Error]: msDrawMap(): Failed to draw layer named 'grass_POSTGRES'.
\n in /home/Documenti/pub/prove_w/visuo_map_file.php on line 6
[Mon Jul 03 18:15:45 2006] [error] [client 192.168.0.110] PHP Warning:
[MapServer Error]: msOGRLayerInitItemInfo(): Invalid Field name: atc_num\n
in /home/Documenti/pub/prove_w/visuo_map_file.php on line 6
[Mon Jul 03 18:15:45 2006] [error] [client 192.168.0.110] PHP Fatal error:
Call to a member function on a non-object
in /home/Documenti/pub/prove_w/visuo_map_file.php on line 8

The mapfile is like:

LAYER
  NAME "grass_POSTGRES"
  TYPE POLYGON
  CONNECTIONTYPE OGR

CONNECTION
"/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head"
  DATA "1"
  STATUS ON
  LABELITEM "atc_num"

  CLASS
    NAME "Ne so veramente troppe"
# EXPRESSION ([atc_num]=13)
    STYLE
      COLOR 0 240 0
      OUTLINECOLOR 0 100 0
    END
    LABEL
        COLOR 200 0 0
        BUFFER 2
      END
  END
END

Quite frustrating.
All the best.
pc

Stephan Holl wrote:

Hello Paolo,

On Fri, 30 Jun 2006 10:24:14 +0200 Paolo Cavallini
<cavallini@faunalia.it> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stephen.
In fact, www-data accesses the db; it does not seem able to use the
.grasslogin6.
Anybody has a hint?
Many thanks.
pc

have you set the HOME variable for user www-data using apaches
SetEnv-stuff in apache.conf?

Perhaps this might help?

Best
  Stephan

- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEqUkX/NedwLUzIr4RAv2/AKCBoWG4XqLBfhudIyZslfxbZofeIgCeOLGP
p8sZMWAUtjgTGlBND8PYoZ0=
=nY2N
-----END PGP SIGNATURE-----

Hello Paolo,

On Mon, 03 Jul 2006 18:43:04 +0200 Paolo Cavallini
<cavallini@faunalia.it> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Further testing.
Now www-data can do whatherver with ogr, eg.

Did you use SetEnv HOME for www-data?

ogrinfo -so -where atc_num=13
/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head
1

gives:

Layer name: 1
Geometry: Polygon
Feature Count: 18
Extent: (1554732.664063, 4678313.000000) - (1771665.406250,
4924775.960937) Layer SRS WKT:
PROJCS["Transverse Mercator",
    GEOGCS["international",
        DATUM["Monte_Mario",
...

but if we use a string, eg
ogrinfo -so -where nomemin='lucca'
/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head
1

we get:

Warning 1: GRASS warning: GISBASE enviroment variable was not set,
using: /usr/lib/grass
INFO: Open of
`/home/Documenti/datigrass/Toscana/PERMANENT/vector/t_comuni_2003/head'
using driver `GRASS' successful.
DBMI-Postgres driver error:
Cannot select:
SELECT * FROM t_comuni_2003 WHERE nomemin=lucca ORDER BY cat
ERROR: la colonna "lucca" non esiste

AFAIK this should be
SELECT * FROM t_comuni_2003 WHERE nomemin='lucca' ORDER BY
cat;

assuming column nomein is a varchar/char column.
So probably a bug in GRASS postgres implementation?!

ERROR 1: Cannot open cursor.

Layer name: 1
Geometry: Polygon
Feature Count: 313
Extent: (1554732.664063, 4678313.000000) - (1771665.406250,
4924775.960937) Layer SRS WKT:
PROJCS["Transverse Mercator",
    GEOGCS["international",
        DATUM["Monte_Mario",
...

as we can see, there is an error with the database connection
(possibly due to the removal of ' ?)

Maybe related to this, mapserver cannot connect to the DB; grass
layers are loaded and shown, but if we try connecting to PostgreSQL
(e.g. LABELITEM, EXPRESSION...) we get an errore:

I think this is because of the missing ''-signs in the SQL-querry.
Have you inverstigated the Postgresql-driver-bindings in the sources
where the SQL is generated?

[Mon Jul 03 18:15:45 2006] [error] [client 192.168.0.110] PHP Warning:
[MapServer Error]: msDrawMap(): Failed to draw layer named
'grass_POSTGRES'. \n
in /home/Documenti/pub/prove_w/visuo_map_file.php on line 6 [Mon Jul
03 18:15:45 2006] [error] [client 192.168.0.110] PHP Warning:
[MapServer Error]: msOGRLayerInitItemInfo(): Invalid Field name:
atc_num\n in /home/Documenti/pub/prove_w/visuo_map_file.php on line 6
[Mon Jul 03 18:15:45 2006] [error] [client 192.168.0.110] PHP Fatal
error: Call to a member function on a non-object
in /home/Documenti/pub/prove_w/visuo_map_file.php on line 8

[...]

Quite frustrating.

Yes, I can imagine. Hope this will be sorted out soon.

Best regards

  Stephan

Stephan Holl wrote:
> Hello Paolo,
>
> On Fri, 30 Jun 2006 10:24:14 +0200 Paolo Cavallini
> <cavallini@faunalia.it> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi Stephen.
>> In fact, www-data accesses the db; it does not seem able to use the
>> .grasslogin6.
>> Anybody has a hint?
>> Many thanks.
>> pc
>
> have you set the HOME variable for user www-data using apaches
> SetEnv-stuff in apache.conf?
>
> Perhaps this might help?
>
> Best
> Stephan
>

- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel:
(+39)348-3801953 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEqUkX/NedwLUzIr4RAv2/AKCBoWG4XqLBfhudIyZslfxbZofeIgCeOLGP
p8sZMWAUtjgTGlBND8PYoZ0=
=nY2N
-----END PGP SIGNATURE-----

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508