Opened 22 years ago

Last modified 22 years ago

#150 closed defect (fixed)

A/I ASCII Grid - header problems.

Reported by: warmerdam Owned by: dron
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Dear list,
I found out, that r.in.gdal has some problems with importing
asc-grid-files. 
It is not really a problem, but r.in.gdal is abit picky about the order
of the header columns.
If the order of the header is different, it bails out and does not
import.

This one does NOT work:
GRASS:~/tmp/data > less qtotal.asc |head -6
yllcorner    5680384
xllcorner    3338768
nrows        3244
ncols        3400
cellsize     100
NODATA_value -9999

But this one does:
GRASS:~/tmp/data > less qtotal.asc |head -6
ncols         3400
nrows         3244
xllcorner     3338768
yllcorner     5680384
cellsize      100
NODATA_value  -9999

When I change the order, everything is fine.
I cannot tell you where the grid-file is exported from, but I guess from
some ersi-products....
Arcview itself imports without trouble.

cheers

  steph

Change History (10)

comment:1 by warmerdam, 22 years ago

Andrey,

Could you correct this (frmts/aaigrid/aaigriddataset.cpp)?  

I think the AAIGDataset::Open() method should continue to get the keywords as it
does now, but that the code should no longer look for particular orderings. 
It should be generalized to allow (essentially) any order, and to skip keywords 
that it doesn't know.  

Also, I would like output support for grids implemented.  Do you have access
to an Arc/Info w/grid license that you could use to test such a thing? 


comment:2 by dron, 22 years ago

> I would like output support for grids implemented.  Do you have access
> to an Arc/Info w/grid license that you could use to test such a thing?

I havn't permenent access to Arc/Info, but I will try to implement grid writing
and find a suitable Arc/Info installation for test purposes.


comment:3 by dron, 22 years ago

First issue fixed now: header records may follow in any order.

comment:4 by dron, 22 years ago

Writing of ASCII Grid files implemented with CreateCopy() function. Not commited
yet because I have two questions:

1. Should Create() function also be implemented?
2. Should we write a ".prj" file along with AAIGrig file? Maybe it should be
controlled by option?

comment:5 by warmerdam, 22 years ago

1) Don't implement a Create() method. It isn't necessary and is hard to 
implement properly for formats like ascii grids. 

2) Write the .prj file if a non-empty projection is available. 


comment:6 by dron, 22 years ago

Frank,

It seems I need to implement OGRSpatialReference::exportToESRI() function. I can
deduce .prj file format from the OGRSpatialReference::importFromESRI() function,
but maybe you know if .prj file format description exists somewhere?

comment:7 by warmerdam, 22 years ago

Andrey,

I am in no hurry to support "old arc/info .prj" file format for export.  Just
use OGRSpatialReference.morphToEsri() and then exportToWkt() and write that to 
the .prj file.  This should work with Arc8 (which uses an ESRI variant on WKT)
and folks with Arc/Info 7 can just delete the .prj file and redefine it
themselves.

comment:8 by dron, 22 years ago

Now AAGrid driver will write a .prj file.

Last question: do we have a universal mechanism for 'no data' values handling?
Such values may be used in ASCII grids.

comment:9 by warmerdam, 22 years ago

Formats supporting nodata values should implement the GetNoDataValue() and
SetNoDataValue() methods.  Note that pbSuccess should be set to FALSE if
there is nodata value for a format. 

Some applications, such as OpenEV, will mark all "nodata" areas to transparent.

comment:10 by dron, 22 years ago

> Note that pbSuccess should be set to FALSE if
> there is nodata value for a format.

Do you mean `if there is _no_ nodata value' ? I have implement nodata handling
in such way.

Writing support finished, but not tested with Arc/Info, because I havn't access
to this software right now. I shall test it in nearest time.

Note: See TracTickets for help on using tickets.