[GRASSLIST:970] Re: Newbie Problem with Raster File Import GRASS 5

Glynn Clements glynn.clements at virgin.net
Sun Aug 17 21:29:55 EDT 2003


Dave Edelman wrote:

> I'm sure that this is a pure ignorance issue but I don't see anything
> obvious in the docs so a gentle pointer to the appropriate TFM or a direct
> to the point answer sure would be appreciated.
> 
> I set up a location with what I think are appropriate parameters. 
> 
> g.region gives me this:
> 
> CURRENT REGION: N=41:37:48.36N  S=41:32:48.48N  RES=0:00:00.36  ROWS=833
>                 E=74:53:43.44W  W=75:02:35.52W  RES=0:00:00.36  COLS=1478
> PROJECTION: 3 (Latitude-Longitude)
> ZONE:       0
> DATUM:      ** unknown (default WGS84) **
> ELLIPSOID:  wgs84
> 
> I have a tiff image from topozone with an associated tfw file that shows
> this:
> 
> 5.0800000000
> 0.0000000000
> 0.0000000000
> -5.0800000000
> 495812.6492529264
> 4609362.2176114470

The last two numbers indicate that this *isn't* lat/lon, so don't try
to import it into a lat/lon location. Ideally, import it into a
location whose projection matches that of the image. If you don't know
the image's projection, import it into an X/Y location instead.

If you import it into a location with a known projection (i.e. not
X/Y), you can then re-project it into a lat/lon location with r.proj.

> When I attempt to import the file I get this: 
> 
> TIFF Directory at offset 0x8
>   Subfile Type: multi-page document (2 = 0x2)
>   Image Width: 2657 Image Length: 2165
>   Resolution: 150, 150 pixels/inch
>   Bits/Sample: 8
>   Compression Scheme: None
>   Photometric Interpretation: RGB color
>   Orientation: row 0 top, col 0 lhs
>   Samples/Pixel: 3
>   Rows/Strip: 1
>   Planar Configuration: single image plane
>   Page Number: 0-1
>   Looking for TIFF World file ...   Found it!
> WARNING: G_set_window(): Illegal latitude for North
> ERROR: couldn't set cellhd.
> 
> I suspect that the region's latitude doesn't accommodate the tfw file's
> parameters but I'll be darned (or worse) if I can figure how the region
> needs to be changed.

The region isn't used when importing images; instead, they are
imported cell-for-cell, with default boundaries.

The map's boundaries will initially be set using the georeferencing
information from the image, (if such is present, and if the import
utility understands it).

If the image isn't georeferenced (or if the importer doesn't support
it), the initial boundaries will have the bottom-left corner at the
origin of the location's coordinate system (i.e. <0,0>), and will be
sized such that one unit (foot, metre, degree) equals one cell
(pixel).

This can cause problems for importing into a lat/lon location. If the
image is more than 90 pixels high, you will get an "Illegal latitude"
error as above (similarly for images more than 180 pixels wide). A
possible workaround is to change the location's projection to X/Y
before importing, then set it back afterwards (IIRC, r.in.tiff does
this automatically).

In any case, you can subsequently change the image's boundaries using
r.region or r.support.

> The raster file is really the set of boundries that I wanted, how do I
> convert the tfw file's easting/northing information to lat/lon (if that is
> the appropriate way to fix the issue?

It almost certainly isn't correct. For most projections (i.e. 
everything except Plate Carée, aka Equidistant Cylindrical), the
relationship between lat/lon and projected coordinates is non-linear.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list