[GRASS-user] Using v.in.ascii to create elevation vector

Hi folks,

I am trying to convert ascii files that I bought from the Irish Ordinance Survey in to GRASS vector format. These are digital terrain models. I want to eventually make a raster surface map and a 3d raster map out demonstrating where various archaeological sites are.

The files the OSI has sent me have a heading set off with "#" on each line, then the data. There are three columns, eventually x, y, z. These are separated by a space.

Using v.in.ascii, I checked Create 3D file

selected the input file, in this case 0834_10.DTM and typed the out put file osi0834. The field separator was set to |. I erased this, and left it blank. Input file format was set to point.

I clicked on the Columns tab. I left the SQL blank. Left x=1 y=2 and set Z=3.

When I hit run I got:

Scanning input for column types...

Maximum input row length: 33

Maximum number of columns: 1

Minimum number of columns: 1

y column number > minimum last column number

(incorrect field separator?)

I put the | back and got the same error.

I then set the input file format to standard and got:

Unexpected data in vector head:

[#]

I have a lot of these to convert. Can anyone give me any advice?

Kurt

Kurt Springs wrote:

I am trying to convert ascii files that I bought from the
Irish Ordinance Survey in to GRASS vector format. These are
digital terrain models. I want to eventually make a raster
surface map and a 3d raster map out demonstrating where
various archaeological sites are.

The files the OSI has sent me have a heading set off with
"#" on each line, then the data. There are three
columns, eventually x, y, z. These are separated by a
space.

Using v.in.ascii, I checked Create 3D file
selected the input file, in this case 0834_10.DTM and typed
the out put file osi0834. The field separator was set to |.
I erased this, and left it blank.

if they are separated by spaces, you'll want to put a space there,
or the word "space".

Input file format was set to point.

I clicked on the Columns tab. I left the SQL blank. Left
x=1 y=2 and set Z=3.

When I hit run I got:

Scanning input for column types...
Maximum input row length: 33
Maximum number of columns: 1
Minimum number of columns: 1
y column number > minimum last column number

(incorrect field separator?)

I put the | back and got the same error.

(should be space)

I then set the input file format to standard and got:

Unexpected data in vector head:
[#]

if should be in points mode.

lines starting with # are treaded as comments, and automatically skipped.
header lines not starting with # should be skipped with the skip= param.

I have a lot of these to convert. Can anyone give me any
advice?

hopefully the above gets you there.

Are the DEMs gridded or sparse? if gridded you might be able to load them
directly with r.in.xyz after sorting out the bounds and resolution.
(verify that "n" map is all 1s with r.univar)

Hamish

2008/11/16 Kurt Springs <ferret_bard@mac.com>:

Hi folks,

I am trying to convert ascii files that I bought from the Irish Ordinance
Survey in to GRASS vector format. These are digital terrain models. I want
to eventually make a raster surface map and a 3d raster map out
demonstrating where various archaeological sites are.

The files the OSI has sent me have a heading set off with "#" on each line,
then the data. There are three columns, eventually x, y, z. These are
separated by a space.

I think you should remove the character "#" for all lines with data.

You must go from lines like these:

# x y z

To lineas like these:

x y z

You can do this, using the linux command "sed". You must execute
something like these:

$ sed 's/^#\ *//g' datos_orig.xyz > datos.xyz

Using v.in.ascii, I checked Create 3D file

selected the input file, in this case 0834_10.DTM and typed the out put file
osi0834. The field separator was set to |. I erased this, and left it
blank. Input file format was set to point.

I clicked on the Columns tab. I left the SQL blank. Left x=1 y=2 and set
Z=3.

When I hit run I got:

Scanning input for column types...

Maximum input row length: 33

Maximum number of columns: 1

Minimum number of columns: 1

y column number > minimum last column number

(incorrect field separator?)

I put the | back and got the same error.

I then set the input file format to standard and got:

Unexpected data in vector head:

[#]

I have a lot of these to convert. Can anyone give me any advice?

If I understood, you must delete the "#". See my previous comment in
this message.

José María

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

On Sun, 16 Nov 2008, Kurt Springs wrote:

Hi folks,

I am trying to convert ascii files that I bought from the Irish Ordinance Survey in to GRASS vector format. These are digital terrain models. I want to eventually make a raster surface map and a 3d raster map out demonstrating where various archaeological sites are.

The files the OSI has sent me have a heading set off with "#" on each line, then the data. There are three columns, eventually x, y, z. These are separated by a space.

Some years ago I obtained gridded DEM data from the Ordnance Survey of Northern Ireland, and I wonder if this was the same format. The two Ordnance Surveys in Ireland do seem to do a reasonable amount of cross-border co-operation. Anyway (I didn't actually use the gridded DEM data; they just sent me a sample to see if it would be useful for our purposes) the data I obtained was gridded at 50m resolution, i.e. it was already in raster format so as Hamish said could be directly imported as a raster. Could you maybe post a short sample of a few lines of the data format so that we can see the format exactly? ISTR (this was perhaps 6 years ago so memory a little hazy) that I wrote a Perl script to process the DEM format - if it *is* the same format I could try digging it out for you.

What is the resolution of the data? There are global free elevation datasets with a better resolution than 50m these days. Also with the OSNI data I realised that it had just been interpolated from contours with some other GIS, and I decided I was much better interpolating my own DEM directly from vector contour maps using one of the superior algorithms in GRASS. I got the vector contour maps from OSNI in DXF format and imported them into GRASS with v.in.dxf. I would recommend this approach over pre-gridded DTM data if possible, as it gives you more control over interpolating a DEM that is most useful for your purposes.

Paul

Thanks everyone. What Hamish suggested worked with the v.in.ascii, or at least got me to the next step. I am not sure if these are gridded or sparse.

However, instead of the vector elevation lines, that I was expecting, I generated a black box, type, thing that vaguely represents the terrain I am interested in. So, I used r.in.xyz. Worked like a charm. It generated a 3d model in NVIZ as well. Is there a way to generate a 3d raster surface for grass itself, like the ARCGIS TIN file? Also, I have a number of these tiles. I was going to make them into the raster maps as individual project Locations, then create one big project location and import them once they're generated. Then I can put all the sites into one map (or one map made up of little maps. I remember doing that this way back in the days of 5.0.x. Is there an easier way to do it now?

Again thanks you Hamish, José, and Paul.

Kurt
On Nov 17, 2008, at 12:55 AM, Hamish wrote:

Kurt Springs wrote:

I am trying to convert ascii files that I bought from the
Irish Ordinance Survey in to GRASS vector format. These are
digital terrain models. I want to eventually make a raster
surface map and a 3d raster map out demonstrating where
various archaeological sites are.

The files the OSI has sent me have a heading set off with
"#" on each line, then the data. There are three
columns, eventually x, y, z. These are separated by a
space.

Using v.in.ascii, I checked Create 3D file
selected the input file, in this case 0834_10.DTM and typed
the out put file osi0834. The field separator was set to |.
I erased this, and left it blank.

if they are separated by spaces, you'll want to put a space there,
or the word "space".

Input file format was set to point.

I clicked on the Columns tab. I left the SQL blank. Left
x=1 y=2 and set Z=3.

When I hit run I got:

Scanning input for column types...
Maximum input row length: 33
Maximum number of columns: 1
Minimum number of columns: 1
y column number > minimum last column number

(incorrect field separator?)

I put the | back and got the same error.

(should be space)

I then set the input file format to standard and got:

Unexpected data in vector head:
[#]

if should be in points mode.

lines starting with # are treaded as comments, and automatically skipped.
header lines not starting with # should be skipped with the skip= param.

I have a lot of these to convert. Can anyone give me any
advice?

hopefully the above gets you there.

Are the DEMs gridded or sparse? if gridded you might be able to load them
directly with r.in.xyz after sorting out the bounds and resolution.
(verify that "n" map is all 1s with r.univar)

Hamish