[GRASS5] r.in.png error?

I used the PNG driver in GRASS to create a PNG image from my data. I verified that the PNG image exists, and I can view it with any app capable of reading the PNG format. I have not modified the region, and I have verified that it is the same as when I originally created the PNG file. However, when I attempt to import the PNG file using r.in.png, I get the following error...

640 x 480 image, 8 bits palette+transparency // this is just extra since I had the verbose option on
WARNING: G_set_window(): Illegal latitude for North
ERROR: Unable to set window

Is there a way around this error?

Thanks,
David

David Piasecki wrote:

I used the PNG driver in GRASS to create a PNG image from my data. I
verified that the PNG image exists, and I can view it with any app
capable of reading the PNG format. I have not modified the region, and
I have verified that it is the same as when I originally created the
PNG file. However, when I attempt to import the PNG file using
r.in.png, I get the following error...

640 x 480 image, 8 bits palette+transparency // this is just extra
since I had the verbose option on
WARNING: G_set_window(): Illegal latitude for North
ERROR: Unable to set window

Is there a way around this error?

This is a known issue with importing rasters into a lat/lon location.

Unless the raster has georeferencing information (and the importer can
use it; AFAIK, this is currently only true of r.in.tiff and
r.in.gdal), rasters are imported with the bottom-left corner at (0,0)
and the top-right corner at (W,H), where W and H are the width and
height of the raster.

In this case, r.in.png is trying to set the top-right corner of the
region to (640,480), which isn't valid for a lat/lon location.

A workaround is to change the location's projection to X/Y with
g.setproj, import the raster, set its boundaries with r.region, then
change the location back to lat/lon.

Ultimately, someone needs to change the various r.in.* programs to
handle this situation.

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

On Thu, Sep 02, 2004 at 01:24:45AM +0100, Glynn Clements wrote:

David Piasecki wrote:

> I used the PNG driver in GRASS to create a PNG image from my data. I
> verified that the PNG image exists, and I can view it with any app
> capable of reading the PNG format. I have not modified the region, and
> I have verified that it is the same as when I originally created the
> PNG file. However, when I attempt to import the PNG file using
> r.in.png, I get the following error...
>
> 640 x 480 image, 8 bits palette+transparency // this is just extra
> since I had the verbose option on
> WARNING: G_set_window(): Illegal latitude for North
> ERROR: Unable to set window
>
> Is there a way around this error?

This is a known issue with importing rasters into a lat/lon location.

Unless the raster has georeferencing information (and the importer can
use it; AFAIK, this is currently only true of r.in.tiff and
r.in.gdal), rasters are imported with the bottom-left corner at (0,0)
and the top-right corner at (W,H), where W and H are the width and
height of the raster.

In this case, r.in.png is trying to set the top-right corner of the
region to (640,480), which isn't valid for a lat/lon location.

A workaround is to change the location's projection to X/Y with
g.setproj, import the raster, set its boundaries with r.region, then
change the location back to lat/lon.

Ultimately, someone needs to change the various r.in.* programs to
handle this situation.

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

Please make it a bug report in case it isn't already there.

Markus