Generate ESRI grid with xllcenter/yllcenter in header

4540
10
05-03-2016 08:25 AM
MáriaChupáčová
New Contributor

Hi,

I'm trying to generate ARC/INFO ASCII GRID (*.asc) from point feature class using create TIN - TIN to raster - raster to ASCII functions. I'm looking for a way to have the output raster file header refering to center of left lower pixel instead of corner. (xllcenter/yllcenter instead of xllcorner/yllcorner).

Also I would like to know if the actual values for each pixel (height in my case, as I'm creating a DTM) depend on the information in header (if they are calculated for the center of pixel when xllcenter/yllcenter information are given in header). And related question - it is correct if I just rewrite the header from corner to center and change the coordinates to coordinates of center of the left lower pixel or is the height value for each pixel calculated also to corner of pixel?)

Thank you very much for answers.

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

Raster to ASCII—Help | ArcGIS for Desktop This tool only writes to the LL corner, however,

ASCII to Raster—Help | ArcGIS for Desktop support LL and center... go figure.

I rewrite the header all the time... it is a quick way to make small adjustments in position or if I want to fix scaling a bit or a lot.  It doesn't affect the data one bit.

0 Kudos
MáriaChupáčová
New Contributor

Thank you for answering, but I still can't find where to set the parameter for the function to use center of LLpixel. Also I need the output to be *.asc, so the only way is to use ascii to raster (and somehow set it to use the center) and then again raster to ascii if I understood your suggestion. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

The tool sets it to ascii to the lower left.  I just do my edits using a text editor

The header section below shows the number of rows and columns and the lower left X and Y values, the cell size, a nodata value... followed by the data.  I I want to make it the 'center' I just move the XLLCORNER/YLLCORNER by 1/2 half the cellsize in the direction needed to put the spot in the right location.  Then when I am done editing (did I say only on a backup), I then use the tool to make it a raster.

NCOLS 480

NROWS 450

XLLCORNER 378922

YLLCORNER 4072345

CELLSIZE 30

NODATA_VALUE -32768

43 2 45 7 3 56 2 5 23 65 34 6 32 54 57 34

35 45 65 34 2 6 78 4 2 6 89 3 2 7 45 23 5 ...

0 Kudos
MáriaChupáčová
New Contributor

But I don't want to move the raster. I just need the header to use the xllcenter/yllcenter "method" to define the location of LLpixel by center instead of corner. I know, that it works if I change the header like this (using "center method" and adding 1/2 pixel to corner coordinates...and the raster will display on the same spot as in your example):

NCOLS 480

NROWS 450

XLLCENTER 378937

YLLCENTER 4072360

CELLSIZE 30

NODATA_VALUE -32768

43 2 45 7 3 56 2 5 23 65 34 6 32 54 57 34

35 45 65 34 2 6 78 4 2 6 89 3 2 7 45 23 5 ...

I just wanted to know if there is a way to get this type of header directly from ArcGIS (now I just edited each *asc. file header  with python). 

0 Kudos
DanPatterson_Retired
MVP Emeritus

My first post links cover the options available within ArcMap directly, other software or programming links within python are the alternatives.  I didn't know you knew of the workaround or had seen the help... sorry.

0 Kudos
MáriaChupáčová
New Contributor

I wasn't sure if it's correct to just replace parts of header, now I see it's commonly used, so thank you very much for your time.

0 Kudos
DanPatterson_Retired
MVP Emeritus

No problem... just use backups until you get used to it

0 Kudos
DanPatterson_Retired
MVP Emeritus

I assume no one else that has been following the post has any other ideas? Love that global reach section

0 Kudos
DanPatterson_Retired
MVP Emeritus

Maria, this got bumped to the top today, did you hange the question in some way to elaborate on your situation? or was the question just moved?

0 Kudos