[GRASSLIST:5067] Re: v.proj datum errors

GRASS 5.0.0 pre4 (and probably earlier) was “hardwired” to read the state27 definitions when you created a new location. I don’t know if this has been fixed. Eric Miller suggested renaming you grass5/etc/state27 file and the creating a symbolic link to the state27->state83 so that when you created a new location it would read the values from state83. So you might look in your PROJ_INFO files and see what values got used.

Also - I don’t think datum transformations are supported. Somebody please correct me if I’m wrong. In my area (western wyoming) there is only about 1 second of rotation between NAD27 and NAD83 so I have been able to manually edit the headers for raster files and get a workable datum conversion for a small area (a DRG).

Rich

At 05:42 PM 11/25/2002 -0500, you wrote:

Grass 5.0.0
spar-sun-solaris2.7

I am having trouble projecting vector data to a new projection/datum.
I have North Carolina state plane (NCSP) NAD83 Meters raster aerial photo data.
I have NCSP NAD83 Feet road data. I v.proj the road data and it appears fine.
(The roads overlay the roads on the raster.)

I have NCSP NAD27 feet data of Cadastral (Property). When I v.proj this data to
NCSP NAD83 Meters, it appears about 9700 Meters west of the NAD83 data (using
d.measure). When I v.proj UTM zone 18 NAD27 Meters Hydrography data, it appears
at the same relative position as the other NAD27 data (the Cadastral data).

In other words, the NAD83 data lines up. The NAD27 data lines up with NAD27 data.
But NAD27 does not line up with NAD 83.

It looks like the projection is occurring correctly but the datum transformation is not.

I have carefully set up the proj_info and proj_units files. I even copied over Eric Miller’s
state plane files and tried those. Same results. (see http://pweb.jps.net/~egm2/grass/STP/index.html)

The difference is suspiciously similar to the difference in false easting between NCSP NAD83 and
NCSP NAD27.

Projecting from the NAD83 M to NAD27 Ft (the reverse of above) gives similar results
with the NAD83 data appearing 9700 meters east of the NAD27 data

Am I doing something wrong? Has anyone else had a similar problem?

John Gillette

I have pass the first wall. I need some Grass help.

what is the meaning of Location, mapset and database.

I sort get that they are related to the actual path where the data is? Am i correct?

I have made the following dir structure

Inside Home i have created Mapa dir, and inside it a vector dir and inside it a rio dir

/home
/home/mapa
/home/mapa/vector
/home/mapa/vector/rio

inside rio i have make two files:
head (with nothing in it)

and frmt with
FORMAT:postgis
HOST:192.168.0.1
PORT:5432
DATABASE:ejercicio
USER:postgres
PASSWORD:xxxx
GEOM_TABLE:rios
CAT_TABLE:rios
#GEOM_ID:
#GEOM_TYPE:
#GEOM_GEOM:
#CAT_ID:
#CAT_FIELD:
#CAT_CAT:

rios is a NTAM table in ejercicio. I am using it again for categories. Is that all right or i have to separate geometry from categories in pgsql/gis?

after running grass51 i have set

location: vector
Mapset: rio
database: /home/mapa/
<esc><enter>

welcome to grass 5.1
bla bla bla
GRASS:/home/map/vector/rio> d.mon start=x0
d.mon: error while lodaing shared libraries: libpd.so: cannot open shared object file: No such file or directory.

GRASS:/home/map/vector/rio>

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.

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?

Juanse
temuko-Chile

  ----- Original Message -----
  From: Richard Greenwood
  To: Juanse
  Sent: Monday, November 25, 2002 8:16 PM
  Subject: Re: Grass to Postgres

  It is no bother at all, but I'm afraid that I have not tried connecting to PostGIS from GRASS. I have only used PostGIS with MapServer. Keep trying on the GRASS list and maybe try asking the Refractions guys for help. And please post your finding because I would like to give it a try if I ever find some time.

  Best regards,
  Rich

  At 08:09 PM 11/25/2002 -0300, you wrote:

    Hi Richard
     
    Sorry to bother directly but seem that this Grass to Postgres is to much for a new comer.
     
    have you tried it yet?
     
    can i bother with some questions?
     
    Having the data already in postgreSQL/PostGIS, how to read it with Grass?
     
    I am making the head and frmt, but have question as to the definition of various entries, the same applies for location, mapset and database.
     
    Juanse
    temuko-Chile
     
    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02

  Richard W. Greenwood, PLS
  Greenwood Mapping, Inc.
  Rich@GreenwoodMap.com
  (307) 733-0203
  http://www.GreenwoodMap.com

This is the reply of an amateur user, and I happily defer to
anyone with real expertise. It took me a long time to
understand how to get anything out of GRASS, but now I am a
dedicated user.

I strongly recommend beginning with one of the tutorials
listed at http://grass.ibiblio.org/gdp/index.html Most of
them come with sample datasets to use, e.g., leics
(Leicestershire, GB) or spearfish (South Dakota, USA). I
learned a lot from the Leicestershire tutorial
http://www.geog.le.ac.uk/assist/grass/seeds/gs_html.html

I also recommend the book Open Source GRASS: A GRASS GIS
Approach by Neteler and Mitasova.

I have pass the first wall. I need some Grass help. what
is the meaning of Location, mapset and database.

The database gives the path of the directory that contains
the complete collection of GRASS datasets that you use.

The Location is defined by the core information about the
particular area that you are examining (region, coordinate
system, projection, datum). Note that "create a new
location" is an option on the opening GRASS screen, and the
prompts, e.g., "choose a projection," are pretty clear for
creating a new location. (It took me a long time to notice
the new location option, and I could only create new maps by
importing them to existing locations and rearranging.)

The mapset is a particular collection of maps (layers) for
the location. A Location often has two mapsets: PERMANENT
(which contains the basic maps given for the Location as
well as the basic location, projection, datum info) and
<username> (which contains maps that you have created by
analyzing, recoding, calculating, etc. from the PERMANENT
mapset). You only need one mapset per Location if you do
not mind using and changing the PERMANENT collection.

Each mapset then contains a collection of vector, raster,
and site maps. A map is a collection of files that includes
the GIS data, categories, attributes, labels, etc.

I sort get that they are related to the actual path
where the data is? Am i correct? I have made the
following dir structure Inside Home i have created Mapa
dir, and inside it a vector dir and inside it a rio dir

/home
/home/mapa
/home/mapa/vector
/home/mapa/vector/rio

inside rio i have make two files:
head (with nothing in it)

and frmt with
FORMAT:postgis
HOST:192.168.0.1
PORT:5432
DATABASE:ejercicio
USER:postgres
PASSWORD:xxxx
GEOM_TABLE:rios
CAT_TABLE:rios
#GEOM_ID:
#GEOM_TYPE:
#GEOM_GEOM:
#CAT_ID:
#CAT_FIELD:
#CAT_CAT:

rios is a NTAM table in ejercicio. I am using it again
for categories. Is that all right or i have to separate
geometry from categories in pgsql/gis?

I don't know what this means.

after running grass51 i have set

location: vector
Mapset: rio
database: /home/mapa/
<esc><enter>

welcome to grass 5.1
bla bla bla
GRASS:/home/map/vector/rio> d.mon start=x0
d.mon: error while loading shared libraries: libpd.so: cannot open shared object file: No such file or directory.

GRASS:/home/map/vector/rio>

where do i have the mistake?

(0) You may have a problem with the GRASS installation.
The shared libraries error does not sound good.

(1) I don't think that you have a valid location. I really
recommend downloading some of the tutorial datasets and
exploring the organization of files.

Do I need that pqsql library installed in the client
machine? why? Is is already installed on the pgsql
server.

I don't know. I don't think that you need any sql material
for basic map processing, only if you want to connect
database information to your maps. You can get a lot done
without a database connection. (But I would be grateful for
a simple tutorial.)

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?

I don't know.

--
Michael Ash, Assistant Professor
  of Economics and Public Policy
Department of Economics and CPPA
University of Massachusetts
Amherst, MA 01003
Tel 413-545-6329 Fax 413-545-2921
Email mash@econs.umass.edu
http://www-unix.oit.umass.edu/~maash

Right, it is actually not that simple to read a postgresql/postgis layer from grass5.1

after reading and trying, trying and reading, it seem that postgis file structure is not suited for grass5.1 postgrass directly reading.

In fmrt files i am ask to provide several fields for grass to be able to find the geometry and category data.

Postgis stores in one column in my case wkb_geometry, a string identifying at the same type the SRID, the geometry type and the actual geometry in wkb, with a constrain at the end that tell pgsql how this string is constructed (Am i right?).

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?

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?

Juanse
temuko-Chile

  ----- Original Message -----
  From: Juanse
  To: Richard Greenwood
  Cc: postgis-users@postgis.refractions.net ; GRASSList@baylor.edu
  Sent: Monday, November 25, 2002 9:04 PM
  Subject: [GRASSLIST:5069] RE: Grass to Postgres

  I have pass the first wall. I need some Grass help.

  what is the meaning of Location, mapset and database.

  I sort get that they are related to the actual path where the data is? Am i correct?

  I have made the following dir structure

  Inside Home i have created Mapa dir, and inside it a vector dir and inside it a rio dir

  /home
  /home/mapa
  /home/mapa/vector
  /home/mapa/vector/rio

  inside rio i have make two files:
   head (with nothing in it)
   
  and frmt with
  FORMAT:postgis
  HOST:192.168.0.1
  PORT:5432
  DATABASE:ejercicio
  USER:postgres
  PASSWORD:xxxx
  GEOM_TABLE:rios
  CAT_TABLE:rios
  #GEOM_ID:
  #GEOM_TYPE:
  #GEOM_GEOM:
  #CAT_ID:
  #CAT_FIELD:
  #CAT_CAT:

  rios is a NTAM table in ejercicio. I am using it again for categories. Is that all right or i have to separate geometry from categories in pgsql/gis?

  after running grass51 i have set

  location: vector
  Mapset: rio
  database: /home/mapa/
  <esc><enter>

  welcome to grass 5.1
  bla bla bla
  GRASS:/home/map/vector/rio> d.mon start=x0
  d.mon: error while lodaing shared libraries: libpd.so: cannot open shared object file: No such file or directory.

  GRASS:/home/map/vector/rio>

  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.

  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?

  Juanse
  temuko-Chile

    ----- Original Message -----
    From: Richard Greenwood
    To: Juanse
    Sent: Monday, November 25, 2002 8:16 PM
    Subject: Re: Grass to Postgres

    It is no bother at all, but I'm afraid that I have not tried connecting to PostGIS from GRASS. I have only used PostGIS with MapServer. Keep trying on the GRASS list and maybe try asking the Refractions guys for help. And please post your finding because I would like to give it a try if I ever find some time.

    Best regards,
    Rich

    At 08:09 PM 11/25/2002 -0300, you wrote:

      Hi Richard
       
      Sorry to bother directly but seem that this Grass to Postgres is to much for a new comer.
       
      have you tried it yet?
       
      can i bother with some questions?
       
      Having the data already in postgreSQL/PostGIS, how to read it with Grass?
       
      I am making the head and frmt, but have question as to the definition of various entries, the same applies for location, mapset and database.
       
      Juanse
      temuko-Chile
       
      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (http://www.grisoft.com).
      Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02

    Richard W. Greenwood, PLS
    Greenwood Mapping, Inc.
    Rich@GreenwoodMap.com
    (307) 733-0203
    http://www.GreenwoodMap.com

after reading and trying, trying and reading, it seem that postgis file structure is not suited for grass5.1 postgrass directly reading.

This gives a good overview:
http://www.ing.unitn.it/~grass/proceedings/proceedings/pdfs/Blazek_Radim.pdf

In fmrt files i am ask to provide several fields for grass to be able to find the geometry and category data.

Postgis stores in one column in my case wkb_geometry, a string identifying at the same type the SRID, the geometry type and the actual geometry in wkb, with a constrain at the end that tell pgsql how this string is constructed (Am i right?).

I don’t think it is a string, I think it is a BLOB (a Binary Large OBject) and PostgreSQL displays it as a string (with the help of PostGIS). And where do you see this “constrain at the end that tell pgsql how this string is constructed”?

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?

This might help:
http://mapserver.gis.umn.edu/wilma/mapserver-users/0110/msg00283.html

Rich

On Mon, Nov 25, 2002 at 04:01:37PM -0700, Richard Greenwood wrote:

GRASS 5.0.0 pre4 (and probably earlier) was "hardwired" to read the state27
definitions when you created a new location. I don't know if this has been
fixed. Eric Miller suggested renaming you grass5/etc/state27 file and the
creating a symbolic link to the state27->state83 so that when you created a
new location it would read the values from state83. So you might look in
your PROJ_INFO files and see what values got used.

Yes g.setproj is still hardwired for state27. I'm currently in
dereliction of duty, as I've promised to fix the projection handling in
GRASS be more correct and transparent (and handle datums properly)...

Also - I don't think datum transformations are supported. Somebody please
correct me if I'm wrong. In my area (western wyoming) there is only about 1
second of rotation between NAD27 and NAD83 so I have been able to manually
edit the headers for raster files and get a workable datum conversion for a
small area (a DRG).

NADCON nad27<->nad83 support was added to [rsv].proj. They should spew
some messages about the transform. Otherwise, datum transforms are not
support in 5.0.

--
"...the plural of anecdote is [not?] data." - attrib. to George Stigler

          Juanse
  Richard
  Juanse

    after reading and trying, trying and reading, it seem that postgis file structure is not suited for grass5.1 postgrass directly reading.

  This gives a good overview:
  http://www.ing.unitn.it/~grass/proceedings/proceedings/pdfs/Blazek_Radim.pdf

  I been over it, also over the pdf of http://www.rcost.unisannio.it/antoniol/students/PostGrass/
  also others of topology.

    In fmrt files i am ask to provide several fields for grass to be able to find the geometry and category data.
     
    Postgis stores in one column in my case wkb_geometry, a string identifying at the same type the SRID, the geometry type and the actual geometry in wkb, with a constrain at the end that tell pgsql how this string is constructed (Am i right?).

  I don't think it is a string, I think it is a BLOB (a Binary Large OBject) and PostgreSQL displays it as a string (with the help of PostGIS). And where do you see this "constrain at the end that tell pgsql how this string is constructed"?

  You are probably right, if i do ssh \d rios in the type description of wkb_geometry column i get geometry as type and at the end of the table's type table i get this sentence.

  Unique keys: rios_ogc_fid_key
  Check constraints: "$1" (srid(wkb_geometry) = -1)
                     "$2" ((geometrytype(wkb_geometry) = 'LINESTRING'::text) OR (wkb_geometry IS NULL))

  What is this BLOB type? How do you decompose it?

  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.

  In ejercicios db i have related tables for rios linestring layer rios: rios_ogc_fid_seq and one tuple in geometry_columns table. I also have loaded spatial_ref_sys in ejercicio db.

  I should have started with a point table with one attibute, but ... i know this rios very well , ja! and all other tables/layers in ejercicios db are already online with mapserver!! Is the front end the part at this moment. i will love to be able to connect mapinfo to this ... but that does not depend on us.
    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?

  This might help:
  http://mapserver.gis.umn.edu/wilma/mapserver-users/0110/msg00283.html

  Thanks, I will take a look:

  Juanse

  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.417 / Virus Database: 233 - Release Date: 09/11/02

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
http://freegis.org/cgi-bin/viewcvs.cgi/~checkout~/grass51/doc/vector/vector.html#head
or existing vector)
- create frmt file:
FORMAT:postgis
HOST:192.168.0.1
DATABASE:ejercicio
USER:postgres
PASSWORD:xxxx
GEOM_TABLE:riog
CAT_TABLE:rioc
- 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.

libpd.so?

GRASS:/home/map/vector/rio>

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
this library.

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,
ie:

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.

Radim