[GRASS5] GRASS and ESRI: ASCII format

Hi all,

maybe a stupid question, but I don't fully understand how
to interprete the ASCII GRID header of ESRI maps.
I am currently writing a script to generate locations
directly from GIS files.

Example: I have a ESRI header looking like this:

ncols 1121
nrows 1121
xllcorner 3442000
yllcorner 5840000
cellsize 12.5
NODATA_value -9999

My script detects now:
Checking file: v12_grid.asc
Recognized format: ESRI
north: 5854012.5000
south: 5840000
east: 3456012.5000
west: 3442000
cols: 1121
rows: 1121
N-S Resolution: 12.5
W-E Resolution: 12.5

I am quite sure that this is not what to be written to DEFAULT_WIND.
My problem is to understand the "xllcorner/yllcorner" and the behaviour
of GRASS to store in the middle of a cell, properly.

If I change my script to produce:
north: 5854006.2500
south: 5829993.75
east: 3456006.2500
west: 3441993.75
cols: 1120
rows: 1120
N-S Resolution: 12.5
W-E Resolution: 12.5

would I get the ESRI data into GRASS correctly referenced?

Help/confirmation would be appreciated.

Thanks!

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

On Wed, 7 Feb 2001, Markus Neteler wrote:

maybe a stupid question, but I don't fully understand how to interprete
the ASCII GRID header of ESRI maps. I am currently writing a script to
generate locations directly from GIS files.

Markus,

  A few years ago, I wrote a small C program to translate the ESRI exported
.grd file format to something usable. I'll send you the source and
executable (it translated to linux perfectly, of course <g>) this weekend.
I'm on my way out the door for a business trip and I won't be back until
Friday evening.

  The only guess was where ESRI puts the cell location: center, southwest
corner, or some place else. IMO, for most natural system data any error this
induces doesn't matter at all.

Later,

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
              Making environmentally-responsible mining happen. (SM)
                       --------------------------------
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Markus,

I am not familiar with the ESRI ASCII grid. But, once you figure out the
correct registration (grid or pixel) maybe the r.in.ascii module could
be expanded to include this format. If this is possible then maybe the
r.in.arc program could also be included.

If you think this is a reasonable approach then I could take a crack at
it when I get a chance.

--
Bob Covill

Tekmap Consulting
P.O. Box 2016
Fall River, N.S.
B2T 1K6
Canada

E-Mail: bcovill@tekmap.ns.ca
Phone: 902-860-1496
Fax: 902-860-1498

Hi Markus,

Your second translation appears correct except for I think there in "south" under
the GRASS format. It should be 5839993.75. I am also unsure why you dropped the
number of cols & rows by 1.

Lisa

Markus Neteler wrote:

Hi all,

maybe a stupid question, but I don't fully understand how
to interprete the ASCII GRID header of ESRI maps.
I am currently writing a script to generate locations
directly from GIS files.

Example: I have a ESRI header looking like this:

ncols 1121
nrows 1121
xllcorner 3442000
yllcorner 5840000
cellsize 12.5
NODATA_value -9999

My script detects now:
Checking file: v12_grid.asc
Recognized format: ESRI
north: 5854012.5000
south: 5840000
east: 3456012.5000
west: 3442000
cols: 1121
rows: 1121
N-S Resolution: 12.5
W-E Resolution: 12.5

I am quite sure that this is not what to be written to DEFAULT_WIND.
My problem is to understand the "xllcorner/yllcorner" and the behaviour
of GRASS to store in the middle of a cell, properly.

If I change my script to produce:
north: 5854006.2500
south: 5829993.75
east: 3456006.2500
west: 3441993.75
cols: 1120
rows: 1120
N-S Resolution: 12.5
W-E Resolution: 12.5

would I get the ESRI data into GRASS correctly referenced?

Help/confirmation would be appreciated.

Thanks!

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Rich,

On Wed, Feb 07, 2001 at 07:27:20AM -0800, Rich Shepard wrote:

On Wed, 7 Feb 2001, Markus Neteler wrote:

> maybe a stupid question, but I don't fully understand how to interprete
> the ASCII GRID header of ESRI maps. I am currently writing a script to
> generate locations directly from GIS files.

Markus,

  A few years ago, I wrote a small C program to translate the ESRI exported
.grd file format to something usable. I'll send you the source and
executable (it translated to linux perfectly, of course <g>) this weekend.
I'm on my way out the door for a business trip and I won't be back until
Friday evening.

Thanks for the software (other mail). GRASS already has r.in.arc. :slight_smile:

  The only guess was where ESRI puts the cell location: center, southwest
corner, or some place else. IMO, for most natural system data any error this
induces doesn't matter at all.

My question is more related to *translate* the corner-oriented ESRI
manner to cell center oriented GRASS manner without getting a shift
of cells.

Anyway, I'll take a look into your program.

Enjoy your trip,
thanks

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

On Wed, Feb 07, 2001 at 10:43:02AM -0500, Frank Warmerdam wrote:

Markus Neteler wrote:
> My question is more related to *translate* the corner-oriented ESRI
> manner to cell center oriented GRASS manner without getting a shift
> of cells.

Markus,

The ESRI lower left corner values refer to the center of the lower left
pixel.

Frank,

as far as I know there is both "xllcorner" and "xllcenter".
My data have "xllcorner", so I assume it's not the center.

The strange thing is that odd cols/rows come out while I would expect
even cols/rows (one less in each direction). Probably I am just
paranoid?

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Bob,

On Wed, Feb 07, 2001 at 11:57:10AM -0400, Bob Covill wrote:

Markus,

I am not familiar with the ESRI ASCII grid. But, once you figure out the
correct registration (grid or pixel) maybe the r.in.ascii module could
be expanded to include this format. If this is possible then maybe the
r.in.arc program could also be included.

If you think this is a reasonable approach then I could take a crack at
it when I get a chance.

well, what I really need:

A tool which detects from common GIS file the settings (north, south,
east, west, rows, cols, res, proj, zone, datum,...). It should
simply print out these values.

Then I could run my "build_location.sh" script and that's it.

Probably I am just re-inventing the wheel and GDAL could be easily
used for the purpose to have such a small stand-alone program. As I want to
generate a location, this must be run outside of GRASS.
If working well, it can become part of the future entrance screen
which will have the functionality to generate locations from a dataset.

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'