[GRASS-user] ogr-grass

Paolo Cavallini cavallini at faunalia.it
Mon Jul 3 12:43:04 EDT 2006


-----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 at 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 at 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-----




More information about the grass-user mailing list