[GRASSLIST:5081] RE: Grass to Postgres
blazek at itc.it
Tue Nov 26 07:23:32 EST 2002
On Monday 25 November 2002 03:44 am, you wrote:
> At the end, Mr. Blazek, if I decide to proceed with migrating my dataset to
> PostgreSQL/PostGis using ogr2ogr, therefore as OGC-SF, would I be able to
> edit (read/write) that data with Grass 5.1. and generate a TAM data model,
> with the resulting data stored in Postgres? How?
As we have the problem with TAM contra NTAM it is not possible use
PostGIS data imported by ogr2ogr in Grass (OGR support is planned but not
yet present). Data must be imported by GRASS in TAM form. To start with
Grass51 it is good to try first demo dataset from http://mpa.itc.it/radim/g51/
Here are suggestions how to start with PostGrass:
- create postgres database ("ejercicio"), there is also 'postgisdb' script
for this in Grass51
- create directory for vector ("rio")
- create header file head (must not be empty, for the format see
or existing vector)
- create frmt file:
- import vector to Grass50 (m.in.e00, I see in your last mail that you
started with e00, it is better to use this because it is TAM), we don't
have v.in.ogr or other import modules in Grass 51
- convert this vector to Grass 51: v.convert imput=rio output=rio
This should create 2 new tables and import data (try by psql)
- run v.build on this file and it should create Grass native topology
- now try d.vect, d.what.vect
> d.mon: error while lodaing shared libraries: libpd.so: cannot open shared
> object file: No such file or directory.
> where do i have the mistake?
> Do I need that pqsql library installed in the client machine? why?
> Is is already installed on the pgsql server.
Yes, you need libpq.so, Grass works here as Postgres client so it requires
> Do i need to make this path structure by hand for each layer i want to use
> in grass eventhough they are all stored in the same pgsql/GIS database?
For now yes, for future you can propose something better.
> Has anyone build a protocol or sql sentence to prepare a postgis table for
> the grass requiered format: ie separate geometry from category with the
> same ID on both tables, and in the geometry table separate the geometry
> from the geometry type?
If the tables for the vector do not exist, and Grass wants to write to that
vector, it is creates automatically.
> which geometry type are allowed in Grass, i have an int4 from >0 to < 5,
> which are those? which int is equivalente to point, which to line, which to
> polyline, which to area and so on?
#define GV_STORE_POINT 1
#define GV_STORE_LINE 2
#define GV_STORE_BOUNDARY 3
#define GV_STORE_CENTROID 4
> I must recall i am doing an on purpose very long
> turn/detour/datajuggling, just to stress posibilities: An original ArcInfo
> E00 (clean and build) import77 to arcview, save as shape, Utranslated to
> tab and then loaded to pgsql/gis ejercicio database via ogr2ogr. I didn't
> put the correct srid, but -1 non earth plane shouldn't matter.
SRID is not used by Grass.
> In the frmt file need for postgrass when defining the name of the type
> column in geometry table could one put the postgis funtion to return that,
> GEOM_TYPE : GeometryType(wkb_geometry)
> GEOM_GEOM: wkb_geometry
No, GeometryType() is POINT, LINESTRING, POLYGON, MULTIPOINT,
MULTILINESTRING, MULTIPOLYGON and in Grass we need
GV_STORE_POINT, GV_STORE_LINE, GV_STORE_BOUNDARY, GV_STORE_CENTROID
so it must be other column.
More information about the grass-user