[GRASS5] Feature-Request: Prompt for PostGIS-connection

Radim Blazek blazek at itc.it
Fri Oct 3 04:36:57 EDT 2003


On Thursday 02 October 2003 11:55, Stephan Holl wrote:
> 	d.vect roads
> was really slow, but....
> * PostGIS-Server is not on the same maschine G57 is running, but  inside
> a 10Mbit-LAN
> * PostGIS-Server is 500Mhz-server
> Maybe this is a bottleneck?

No the problem is in GRASS, 
1) GRASS uses random access (read line by line number), this is
fast for native format but cannot be for RDBMS, as it must send query for
each line and that is slow especially over network (send query and wait
for respons for every line). I don't know how to solve this.
2) Currently, to read one line, GRASS performs more queries:
- select type, NumPoints(), Dimension()
- BEGIN (because binary cursors must be in transaction, IIRC)
- DECLARE gcursor BINARY CURSOR FOR SELECT ASBINARY( "geom FROM table WHERE id = ...")
- FETCH ALL in gcursor
- CLOSE gcursor
- COMMIT
- SELECT field, cat FROM table WHERE id = ...
this could be reduced, probably return to WKT and parse results in GRASS,
so from 7 queries to 2, and PostGIS in GRASS will be faster in this ratio
(7/2) (?). It was my stupid idea that binary cursor is be faster ;)

I am considering to either remove PostGIS support at all or do not officially 
support in 5.8 (or how they call it).

> My purpose was to check, if thuban and/or mapserver can read
> GRASS-imported PostGIS-data, but I failed, because geometry-type
> LINESTRING is not (yet) supported by thuban.
> I realised, that the geometry-column in roads_geom is only called
> 'geom', but imported data via shp2pgsql results in a geomtry-column
> named 'the_geom'.

That is OK, there is no rule for geometry column name, AFAIK.

> BTW, it would be nice to rename the 'geom'-column into 'the_geom' to use
> postGIS-query's from mapserver more intuitively.

For me, it would not be nice, 'the_' is not any information, it is only longer.

> also no entry in the table geometry-columns was made... but maybe I had
> not granted this table for update/insert by this postgres user to write
> an entry...

Yes, GRASS should add record to geometry_columns.

Radim




More information about the grass-dev mailing list