[GRASS-user] Create Vector Map from Data in Postgres Table

   About a year ago I used v.in.ascii to create a point map and save the
attribute data in a postgres table. Now I already have those data in a table
and want to create a points map using the geographic coordinates (x=col 2,
y=col 3), but associating the holeid and other attributes with each point.

   I've run db.connect and db.login within the project location/mapset and
now need to create a vector point ('sites') map from these data. The table
schema is,

CREATE TABLE boreholes (
   holeid TEXT PRIMARY KEY,
   easting NUMERIC(13,6) NOT NULL,
   northing NUMERIC(13,6) NOT NULL,
   surf_elev REAL,
   holedepth INTEGER,
   purpose VARCHAR(16),
   lithology VARCHAR(16),
   hole_diam REAL,
   well_diam REAL,
   flow_gpm REAL,
   h2o_elev REAL,
   comment TEXT
);

   Can I use v.in.ogr to create a GRASS vector map from these data?

   If not, I can create an ASCII text file of the data and use v.in.ascii to
create the map. If this is the way to proceed, I suppose that I need to
empty that database table so the column values will be loaded as v.in.ascii
runs.

   Or, have I completely missed how to do this?

TIA,

Rich

On Fri, 16 Mar 2012, Rich Shepard wrote:

About a year ago I used v.in.ascii to create a point map and save the
attribute data in a postgres table. Now I already have those data in a table
and want to create a points map using the geographic coordinates (x=col 2,
y=col 3), but associating the holeid and other attributes with each point.

If not, I can create an ASCII text file of the data and use v.in.ascii to
create the map. If this is the way to proceed, I suppose that I need to
empty that database table so the column values will be loaded as
v.in.ascii runs.

   Well, creating an ascii text file with 4 columns and trying v.in.ascii I
see the error that the database table cannot be created.

Rich

On 16/03/12 18:15, Rich Shepard wrote:

  About a year ago I used v.in.ascii to create a point map and save the
attribute data in a postgres table. Now I already have those data in a
table
and want to create a points map using the geographic coordinates (x=col 2,
y=col 3), but associating the holeid and other attributes with each point.

I've run db.connect and db.login within the project location/mapset and
now need to create a vector point ('sites') map from these data. The table
schema is,

CREATE TABLE boreholes (
holeid TEXT PRIMARY KEY,
easting NUMERIC(13,6) NOT NULL,
northing NUMERIC(13,6) NOT NULL,
surf_elev REAL,
holedepth INTEGER,
purpose VARCHAR(16),
lithology VARCHAR(16),
hole_diam REAL,
well_diam REAL,
flow_gpm REAL,
h2o_elev REAL,
comment TEXT
);

Can I use v.in.ogr to create a GRASS vector map from these data?

Try v.in.db.

Moritz

On Sun, 18 Mar 2012, Moritz Lennert wrote:

Try v.in.db.

Moritz,

   For reasons I cannot explain I completely missed this module when going
through the list. Thank you for pointing out the obvious.

Rich

On 19/03/12 15:51, Rich Shepard wrote:

On Sun, 18 Mar 2012, Moritz Lennert wrote:

Try v.in.db.

Moritz,

For reasons I cannot explain I completely missed this module when going
through the list. Thank you for pointing out the obvious.

Knowing that there are "over 435 built-in analysis modules" in GRASS (6.4.2 release notes), it is quite normal to not always easily find the one you want at first try :wink:

Moritz