[GRASS-user] Importing Converted Points File

   I converted a points file from lon/lat geographic coordinates to lcc using
cs2cs. The command line used was:

cs2cs +proj=latlong +datum=NAD83 +to +proj=lcc +datum=NAD83 +ellps=GRS80 \
+lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0 \
+nadgrids=WO <<EOF \
122d30'32.43" 45d19'19.49" \
122d30'17.92" 45d18'52.45" \
122d29'34.08" 45d18'47.16" \
EOF

and the output is:

-5056134.11|5898037.45
-5057005.89|5898228.79
-5057306.14|5899149.81

after I stripped off the trailing 0.0 (which I presume is a z value).

   Now, when I try to use these values in v.in.ascii I'm told that column
numbers must not be negative:

GRASS 6.4.0svn (sitesLCC):/usr4/grassbase/sitesLCC > v.in.ascii
input=keypoints/sites_lcc.txt output=sites format=point x=0 y=1
ERROR: Column numbers must not be negative

   Do I just change the longitude values to positive?

Rich

On Sat, Nov 28, 2009 at 12:45 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

I converted a points file from lon/lat geographic coordinates to lcc using
cs2cs. The command line used was:

cs2cs +proj=latlong +datum=NAD83 +to +proj=lcc +datum=NAD83 +ellps=GRS80 \
+lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0 \
+nadgrids=WO <<EOF \
122d30'32.43" 45d19'19.49" \
122d30'17.92" 45d18'52.45" \
122d29'34.08" 45d18'47.16" \
EOF

You may also want to try m.proj (GRASS wrapper for cs2cs):

http://grass.osgeo.org/grass64/manuals/html64_user/m.proj.html

and the output is:

-5056134.11|5898037.45
-5057005.89|5898228.79
-5057306.14|5899149.81

after I stripped off the trailing 0.0 (which I presume is a z value).

Now, when I try to use these values in v.in.ascii I'm told that column
numbers must not be negative:

GRASS 6.4.0svn (sitesLCC):/usr4/grassbase/sitesLCC > v.in.ascii
input=keypoints/sites_lcc.txt output=sites format=point x=0 y=1
ERROR: Column numbers must not be negative

Do I just change the longitude values to positive?

No - it says *number*: You specified x as column 0 but it is the
first. So x=1 y=2 will do it.

Markus

On Sat, 28 Nov 2009, Markus Neteler wrote:

You may also want to try m.proj (GRASS wrapper for cs2cs):
http://grass.osgeo.org/grass64/manuals/html64_user/m.proj.html

Markus,

   I will if the translation is incorrect.

No - it says *number*: You specified x as column 0 but it is the first. So
x=1 y=2 will do it.

   I mis-read the man page. I saw the default of cat=0 but missed the
embedded text about the first column being 1. That explains it.

Thanks,

Rich

Rich, (all)

On Sat, Nov 28, 2009 at 4:15 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Sat, 28 Nov 2009, Markus Neteler wrote:

....

No - it says *number*: You specified x as column 0 but it is the first. So
x=1 y=2 will do it.

I mis-read the man page. I saw the default of cat=0 but missed the
embedded text about the first column being 1. That explains it.

(good)

Generally: If you have suggestions to improve the manual pages,
please don't hesitate to suggest text replacements/additions!

Markus

On Sat, 28 Nov 2009, Markus Neteler wrote:

Generally: If you have suggestions to improve the manual pages, please
don't hesitate to suggest text replacements/additions!

Markus,

   I'll do that. It was my reading too quickly rather than any ambiguity in
the man page.

   Next problem:

GRASS 6.4.0svn (sitesLCC):/usr4/grassbase > v.in.ascii
input=/usr4/keypoints/sites_lcc.txt output=sites format=point columns='x
double precision, y double precision, name varchar(24)' x=1 y=2
Scanning input for column types...
Maximum input row length: 47
Maximum number of columns: 3
Minimum number of columns: 3
ERROR: x column is not of number type

and here's the input data file:

longitude|latitude|name
-5056134.11|5898037.45|name 1
-5057005.89|5898228.79|name 2
-5057306.14|5899149.81|name 3

   It must again be something I did incorrectly in either the re-projection
or specifying the v.in.ascii command. I'm not seeing it, however.

TIA,

Rich

Hi Rich,

Did you skip the first line with the option skip=1

Daniel

On Sat, Nov 28, 2009 at 3:27 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Sat, 28 Nov 2009, Markus Neteler wrote:

Generally: If you have suggestions to improve the manual pages, please
don't hesitate to suggest text replacements/additions!

Markus,

I'll do that. It was my reading too quickly rather than any ambiguity in
the man page.

Next problem:

GRASS 6.4.0svn (sitesLCC):/usr4/grassbase > v.in.ascii
input=/usr4/keypoints/sites_lcc.txt output=sites format=point columns='x
double precision, y double precision, name varchar(24)' x=1 y=2
Scanning input for column types...
Maximum input row length: 47
Maximum number of columns: 3
Minimum number of columns: 3
ERROR: x column is not of number type

and here's the input data file:

longitude|latitude|name
-5056134.11|5898037.45|name 1
-5057005.89|5898228.79|name 2
-5057306.14|5899149.81|name 3

It must again be something I did incorrectly in either the re-projection
or specifying the v.in.ascii command. I'm not seeing it, however.

TIA,

Rich
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Try adding skip=1 to the v.in.ascii command.

Also see the v.in.ascii manual [1]

Markus M

[1] http://grass.osgeo.org/grass64/manuals/html64_user/v.in.ascii.html

Rich Shepard wrote:

On Sat, 28 Nov 2009, Markus Neteler wrote:

Generally: If you have suggestions to improve the manual pages, please
don't hesitate to suggest text replacements/additions!

Markus,

I'll do that. It was my reading too quickly rather than any ambiguity in
the man page.

Next problem:

GRASS 6.4.0svn (sitesLCC):/usr4/grassbase > v.in.ascii
input=/usr4/keypoints/sites_lcc.txt output=sites format=point columns='x
double precision, y double precision, name varchar(24)' x=1 y=2
Scanning input for column types...
Maximum input row length: 47
Maximum number of columns: 3
Minimum number of columns: 3
ERROR: x column is not of number type

and here's the input data file:

longitude|latitude|name
-5056134.11|5898037.45|name 1
-5057005.89|5898228.79|name 2
-5057306.14|5899149.81|name 3

It must again be something I did incorrectly in either the re-projection
or specifying the v.in.ascii command. I'm not seeing it, however.

TIA,

Rich
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Sat, 28 Nov 2009, Daniel Victoria wrote:

Did you skip the first line with the option skip=1

Daniel,

   Nope. That did the trick. I thought the header line needed to be included
for the attribute names.

Thank you,

Rich

On Sat, Nov 28, 2009 at 8:11 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

I thought the header line needed to be included
for the attribute names.

No, that's defined via "column" parameter (like this you can
define names which differ from the first line [if present]).

Markus

On Sat, 28 Nov 2009, Markus Neteler wrote:

No, that's defined via "column" parameter (like this you can define names
which differ from the first line [if present]).

Markus,

   That does clear it all up. Instead of having 'longitude|latitude|name' in
the header line I specify those (along with the data type) in the 'columns'
paramter.

Thank you,

Rich

Rich Shepard wrote:

I thought the header line needed to be included
for the attribute names.

you're thinking of qgis's delimited text import plugin

H

Rich:

  That does clear it all up. Instead of having
'longitude|latitude|name' in
the header line I specify those (along with the data type)
in the 'columns' paramter.

you can keep that line there (months later that meta-data Will save you
a lot of headaches!), just use skip=1 or start the line with a '#'
character to tell v.in.ascii it shouldn't count that line as data.

skip=1 has the advantage of saving the skipped header lines into the
vector map's metadata for later reference.

Hamish