[GRASS-dev] d.out.file: world (wld) file support issue

Hi,

I wanted to add world file support to d.out.file but it seems that
d.info -g doesn't work correctly (-g just added in SVN) in case that
the "res=" parameter of d.out.file is used. The generated world file
remains identical and thus the resulting map shifted.

What's wrong here? Patch attached to generate the world file.

thanks
Markus

(attachments)

d_out_file.diff (995 Bytes)

On Friday 25 January 2008, Markus Neteler wrote:

Hi,

I wanted to add world file support to d.out.file but it seems that
d.info -g doesn't work correctly (-g just added in SVN) in case that
the "res=" parameter of d.out.file is used. The generated world file
remains identical and thus the resulting map shifted.

What's wrong here? Patch attached to generate the world file.

thanks
Markus

I am not sure what is wrong, but... would it make sense to use the facillities
for world file creation that GDAL provides ? via r.out.gdal ?

maybe I am not seeing the subtle differences..

cheers,

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

On Jan 25, 2008 11:21 PM, Dylan Beaudette <dylan.beaudette@gmail.com> wrote:

On Friday 25 January 2008, Markus Neteler wrote:
> Hi,
>
> I wanted to add world file support to d.out.file but it seems that
> d.info -g doesn't work correctly (-g just added in SVN) in case that
> the "res=" parameter of d.out.file is used. The generated world file
> remains identical and thus the resulting map shifted.
>
> What's wrong here? Patch attached to generate the world file.
>
> thanks
> Markus

I am not sure what is wrong, but... would it make sense to use the facillities
for world file creation that GDAL provides ? via r.out.gdal ?

maybe I am not seeing the subtle differences..

I want to write out the *monitor* content with d.out.file (r.out.gdal cannot
do that).

Markus

On Friday 25 January 2008, Markus Neteler wrote:

On Jan 25, 2008 11:21 PM, Dylan Beaudette <dylan.beaudette@gmail.com> wrote:
> On Friday 25 January 2008, Markus Neteler wrote:
> > Hi,
> >
> > I wanted to add world file support to d.out.file but it seems that
> > d.info -g doesn't work correctly (-g just added in SVN) in case that
> > the "res=" parameter of d.out.file is used. The generated world file
> > remains identical and thus the resulting map shifted.
> >
> > What's wrong here? Patch attached to generate the world file.
> >
> > thanks
> > Markus
>
> I am not sure what is wrong, but... would it make sense to use the
> facillities for world file creation that GDAL provides ? via r.out.gdal
> ?
>
> maybe I am not seeing the subtle differences..

I want to write out the *monitor* content with d.out.file (r.out.gdal
cannot do that).

Markus

right.. (whacks head against table...)

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

Markus Neteler wrote:

I wanted to add world file support to d.out.file but it seems that
d.info -g doesn't work correctly (-g just added in SVN) in case that
the "res=" parameter of d.out.file is used. The generated world file
remains identical and thus the resulting map shifted.

What's wrong here? Patch attached to generate the world file.

Hi,
I haven't looked at the patch yet, but some comments.

first of all why not just use g.region for this? when are display NSEW
and g.region NSEW different? I don't understand the point.

display pixel resolution is resampled. It has nothing to do with region
resolution. so to caclulate it you would need to do
(east-west)/$GRASS_WIDTH not (east-west)/ewres

have a look at d.out.gpsdrive. This does the same, it creates world
file(like) output of another flavour, dealing with things like double
and quadruple sizing. [For that I found it nice to quadruple size then
use GIMP's cubic resampler to mix back to target size. Much nicer
output than GRASS's nearest neighbor resampling.]

A solution I have used in the past is to use d.out.file, then
r.in.gdal(XY) + r.region. Then r.out.gdal could make the geotiff of the
image.

ISTR something about using r.mapcalc's r#map, g#map, b#map operators
but don't quite remember how that fit into the puzzle. That was done in
relation to allowing multiple raster overlays in ps.map AFAICR. (??)

other Qs:
how to deal with white bands if region aspect ratio does not match
display window aspect ratio? (see previous changes to d.info needed for
d.out.gpsdrive)

need to check that changes to d.info work correctly in sub-frames.

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Markus Neteler wrote:
> I wanted to add world file support to d.out.file but it seems that
> d.info -g doesn't work correctly (-g just added in SVN)

Hamish wrote:

first of all why not just use g.region for this? when are display
NSEW and g.region NSEW different? I don't understand the point.

oh, NSEW bounds *including* the white out-of-region bands on the side
of the display if the aspect ratios don't match.

anyway, the problem already solved (??) in d.out.gpsdrive in what I
think is a cleaner way. ('d.info -b' + g.region -g,-e)

Looking at it I now remember d.out.gpsdrive tiles are of a fixed size,
I was doubling/quadrupling the display window size & cubic rescaling
with GIMP in a local modification version.

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

On Jan 26, 2008 1:02 AM, Hamish <hamish_b@yahoo.com> wrote:

> Markus Neteler wrote:
> > I wanted to add world file support to d.out.file but it seems that
> > d.info -g doesn't work correctly (-g just added in SVN)

Hamish wrote:
> first of all why not just use g.region for this? when are display
> NSEW and g.region NSEW different? I don't understand the point.

oh, NSEW bounds *including* the white out-of-region bands on the side
of the display if the aspect ratios don't match.

Exactly. That's why I wanted to get the coordinates from the monitor
itself.

anyway, the problem already solved (??) in d.out.gpsdrive in what I
think is a cleaner way. ('d.info -b' + g.region -g,-e)

Thanks, I wasn't aware of d.out.gpsdrive...

Looking at it I now remember d.out.gpsdrive tiles are of a fixed size,
I was doubling/quadrupling the display window size & cubic rescaling
with GIMP in a local modification version.

mhh mhh mhh, mumble. I'll think about it.

Markus

> Hamish wrote:
> anyway, the problem already solved (??) in d.out.gpsdrive in what I
> think is a cleaner way. ('d.info -b' + g.region -g,-e)

Markus:

Thanks, I wasn't aware of d.out.gpsdrive...

> Looking at it I now remember d.out.gpsdrive tiles are of a fixed
> size, I was doubling/quadrupling the display window size & cubic
> rescaling with GIMP in a local modification version.

mhh mhh mhh, mumble. I'll think about it.

the gimp thing was just a local hack to get nicer output when creating
the default GPSDrive backdrop set (Blue Marble).

May I ask what are you trying to include in the GeoTIFF(?)?
Decorations? vector overlays? grid lines? '+' fiducial marks? (ps.map
can make those but d.grid still lacks a flag for that)

Hamish

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Hamish wrote:

'+' fiducial marks? (ps.map can make those but d.grid still lacks a
flag for that)

new fiducial mark symbol added in 6.3svn. see attached preivew + detail
and
http://grass.gdf-hannover.de/wiki/IconSymbols#Existing_symbols

size = 12,15 looks nice in an xmon.
use 45 degree symbol rotation if you wish to align ticks with grid
lines

It would be possible use D_symbol() in d.grid to draw them. (propose
new -c cross & -f fiducial flags for d.grid) Because the way d.grid is
written some new code would be needed to caclulate grid line
interesctions. 45 deg rotation should be applied to align ticks with
grid lines. for geogrids re-use text label rotation angle code to align
ticks with geo grid lines. probably need to calculate that per grid
interection if the map scale is such that the geo-lines are
significantly curved. Maybe for -c just use simple cross icon code from
d.graph, not full D_symbol(cross1).

enjoy,
Hamish

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

(attachments)

symb-fiducial.png
fiducial_2k.png