RE: [GRASS5] r.in.png error?

Glynn,

I've been trying to look up how to use g.setproj, but I haven't figured it
out yet. I am currently using Grass in php. I have created the PNG files,
and now want to access a chosen area PNG file so I can allow the user to
zoom in closer or pan the image. How does one use g.setproj to change the
location's projection to X/Y? I tried it in the Grass terminal and it
appears to be interactive.

Thanks,
- Sharyn namnath

-----Original Message-----
From: Glynn Clements [mailto:glynn.clements@virgin.net]
Sent: Wednesday, September 01, 2004 4:25 PM
To: David Piasecki
Cc: grass5@grass.itc.it
Subject: Re: [GRASS5] r.in.png error?

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>

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Namnath, Sharyn wrote:

I've been trying to look up how to use g.setproj, but I haven't figured it
out yet. I am currently using Grass in php. I have created the PNG files,
and now want to access a chosen area PNG file so I can allow the user to
zoom in closer or pan the image. How does one use g.setproj to change the
location's projection to X/Y? I tried it in the Grass terminal and it
appears to be interactive.

Right. There isn't a non-interactive version; you would have to modify
the WIND file directly. Essentially, you need to change the value on
the "proj:" line; X/Y is 0, lat/lon is 3.

However, it's debatable whether you should be re-importing images
which were created using the PNG driver into GRASS. For
zooming/panning around a map (or series of maps), you would normally
create a new PNG file each time, by the same means that the original
PNG file was created.

In most cases, rendering a map to an image will lose information. If
you re-import the rendered image as a map, then render a new image
from that map, the errors will accumulate.

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