[GRASSLIST:7700] Raster placement coordinates formatting

Hey all,

I've been testing my export code and hit on a problem,
namely the referencing of rasters that I export.
Right now I do an r.out.ascii and read the header,
which essentially gives me the data from the cellhd
directory, specifically north, east, south and west
for a map.

I would like to know what is the various formats
these can be in, and specifically how negative values
are encoded in each and what non-number data
may be in there. The variation seems to stem from
the proj element, which can apparently be
unreferenced (0), UTM (1), state plane (2) and
lat-long (3). Is this true?

--Bart

Bart wrote:

I've been testing my export code and hit on a problem,
namely the referencing of rasters that I export.
Right now I do an r.out.ascii and read the header,
which essentially gives me the data from the cellhd
directory, specifically north, east, south and west
for a map.

I would like to know what is the various formats
these can be in, and specifically how negative values
are encoded in each and what non-number data
may be in there.

For anything other than lat/lon, the bounds are formatted using
sprintf("%.8f") with trailing zeros removed.

For lat/lon, the bounds are in DMS, with one of the forms:

  01:23:45.678N
  01:23:45N (seconds are integral)
  01:23N (seconds are zero)
  01N (minutes & seconds both zero)

The variation seems to stem from
the proj element, which can apparently be
unreferenced (0), UTM (1), state plane (2) and
lat-long (3). Is this true?

Yes. Also, the projection can be 99 (other).

--
Glynn Clements <glynn@gclements.plus.com>