[GRASS-dev] lib/vask

On Fri, 23 Jun 2006 13:25:29 -0700
Michael Barton <michael.barton@asu.edu> wrote:

I.points/i.vpoints/i.rectify are general-purpose rectifying modules.
Except for calculating RMS error, I've replaced them with a new TclTk
georectifier.

BIG KUDO. NO QUESTION ABOUT IT. Will have to try it out.

I.ortho.photo (AFAIK) is a special purpose georectifier for aerial
photos.

That's right. But the interface is pretty much like old i.points. So
maybe your current TCLTK i.points/i.vpoints interface could be adapted?
(Naive?)

Maciek

------------------------------------------------------------------------
CIEP?E KRAJE - CIEP?E MORZA. Szukasz atrakcyjnego wypoczynku w przyst?pnej cenie, zapoznaj si? z nasz? ofert?.
ZAPRASZAMY

www.skarpatravel.pl

From: Markus Neteler <neteler@itc.it>
Date: Sun, 18 Jun 2006 10:37:50 +0200
To: <grass-dev@grass.itc.it>
Subject: i.ortho.photo - was Re: [GRASS-dev] lib/vask

This is probably a good example of why it's important to separate
functionality from interface.

Agreed.

The occasion of rewriting it could go along with the re-integration of the
GRASS 5's image3 library which offers ortho-recitifcation of LANDSAT to
some extent. Something like this:

Merge of image libraries:
  A)
    - lib/imagery/: standard lib, in use (i.* except for i.points3,
i.rectify3)
    - imagery/i.ortho.photo/libes/: standard lib, in use (i.ortho.photo,
photo.*)

See C) below

  B)
    - lib/image3/: never finished improvement which integrated the standard
lib and
                   the ortho lib. Seems to provide also ortho rectification
for
                   satellite data (i.points3, i.rectify3)
  C)
    - merge of i.points, i.vpoints, i.points3, i.points.auto

These are interface modules to create GCP's. They depend on x11 interactive
displays. It makes more sense to do this in a GUI platform except for RMS
calculation, which requires a forward rectification of the GCP's and a
return of their projected coordinates.

Should a separate georectifier be done for i.ortho.photo? Or should the
interactive GUI part just be merged with the GUI for a general purpose
georectifier? If the latter, what would need to be added?

    - merge of i.rectify and i.rectify3
    - addition of new resampling algorithms such as bilinear, cubic
convolution
      (take from r.proj?)
    - add other warping methods (maybe thin splines from GDAL?)
    - implement/finish linewise ortho-rectification of satellite data (from
image3)
    - remove lots of cloned code

Markus

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Could you folks look at the i.points replacement I've written and let me/us
know what other kinds of interaction are needed? I think it covers the
situations you've listed below.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Mon, 19 Jun 2006 19:15:18 +1200
To: Glynn Clements <glynn@gclements.plus.com>
Cc: grass5 <grass-dev@grass.itc.it>, <werchowyna@epf.pl>,
<rez@touchofmadness.com>
Subject: Re: [GRASS-dev] lib/vask

Glynn Clements wrote:

The selection of GCPs should probably be integrated with Michael's
i.points replacement.

Is there any reason why other forms of interaction (other than visual
selection of coordinates) would be necessary?

Beyond the mouse, keyboard entry is needed. e.g. set a GCP to where
lat/lon grid lines meet by marking "+" spot and keying in coordinates,
or getting GCPs coords by travelling to a landmark with a good GPS.

various [Confirm][Cancel] buttons are needed...

or do you mean some sort of human interaction between the data entry
frontend and "the libraries" backend?

What "forms of interaction" did you have in mind?

slightly lost,
Hamish

Going through email after a week away. So I'm sure there will be more
commentary in later digests. But this is a good point to insert an answser.

See below

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Brad Douglas <rez@touchofmadness.com>
Reply-To: <rez@touchofmadness.com>
Date: Tue, 20 Jun 2006 03:46:58 -0700
To: Glynn Clements <glynn@gclements.plus.com>
Cc: <werchowyna@epf.pl>, Hamish <hamish_nospam@yahoo.com>, grass5
<grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask

On Tue, 2006-06-20 at 09:12 +0100, Glynn Clements wrote:

Hamish wrote:

The selection of GCPs should probably be integrated with Michael's
i.points replacement.

Is there any reason why other forms of interaction (other than visual
selection of coordinates) would be necessary?

Beyond the mouse, keyboard entry is needed. e.g. set a GCP to where
lat/lon grid lines meet by marking "+" spot and keying in coordinates,
or getting GCPs coords by travelling to a landmark with a good GPS.

Are you referring to entering one point with the mouse and the
corresponding point as numerical coordinates? I can see why that would
need to be interactive. Can that not be integrated with the i.points
replacement?

Yes. Yes, but might it have to be reimplemented for other modules?

Check the georectify TclTk module.

So far, I've done this and integrated i.points and i.vpoints (for use with
i.rectify), and as well as creating a points file for v.transform.

Markus just told me that elevation would be needed to fold in information
from i.ortho.photo. This is doable, but I don't know what the work flow is
into i.ortho.photo from there (i.e., not to i.rectify at the moment).

Essentially, to what extent is it possible to separate the entry of
GCPs and other parameters from the actual rectification? Ideally, you
want to have as much code as possible in a non-interactive core, with
interaction limited to the outermost layer.

Getting GCPs is one step. Rectification is another step (down the
line). I would also expect to be able to input GCPs via file, also,
however rare it would be used. I plan to implement the rectification
with GDAL, so one way or another, I'll have to get the GCPs into their
format. The input and the "work" would be isolated.

Currently you can read GCP's from an ascii POINTS file for i.rectify and a
points file of any name for vectors. What makes most sense is to merge
formats for raster (i.points/i.vpoints/i.rectify) and vector (v.transform)
points files and their directory structures (currently in the /group
directory for raster and anywhere for vector).

It would probably be a good idea to also fold in i.ortho.photo if it is not
too difficult.

Glynn has recommended using the GDAL library for rectification. Could we
fold all raster rectification--general purpose and aerial photo--into
i.rectify with appropriate options and flags? If so, we could add the
additional rectification methods Hamish mentioned in an earlier post.

How is v.digit going to be handled? That has a similar situation. If
we move solely to a command driven methodology, we won't be able to
digitize/edit [new] vector maps. :frowning:

This is already working in an experimental form using a new v.edit module
and a pyGTK interface. Doesn't look like it will make it to TclTk, though,
unless someone else steps in to do an interface.

various [Confirm][Cancel] buttons are needed...

In most cases, it's preferable to execute operations without
confirmation and to provide an undo feature for dealing with mistakes.

Undo is definitely the way to go here.

I'm not sure what undo would mean for georectification. For GRASS, you
always create a new map with georectification. The original, unrectified,
map remains as it was. Same with the GCP file. So undo is kind of
meaningless. Same with confirm and cancel. If the new map doesn't look
right, just delete it, change the existing GCP's, applying them to original
map, and do it again.

Michael

Hamish and others,

Please see below.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Tue, 20 Jun 2006 23:48:16 +1200
To: <rez@touchofmadness.com>
Cc: <glynn@gclements.plus.com>, <werchowyna@epf.pl>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask

Glynn:

Are you referring to entering one point with the mouse and the
corresponding point as numerical coordinates? I can see why that would
need to be interactive.

Yes.

Glynn:

In most cases, it's preferable to execute operations without
confirmation and to provide an undo feature for dealing with
mistakes.

Brad:

Undo is definitely the way to go here.

For entering GCPs precision and exactitude are much more important than
speed. Each point needs to be carefully checked and double checked.
And, at the risk of using a bad cliche, checked again.

Agreed.

"Review &
confirm" is desired here,

What does this actually mean in terms of the georectify process? Look at
individual and total RMS error and adjust GCP as needed?

as well as delete (any) GCP and disable (any)
GCP.

Agreed. I've got this in the georectify module.

"Undo last point" seems like the knitting nightmares my mother used
to have undoing the whole row trying to get back to that dropped stitch.

For GCP create I don't understand the difference between undo and delete in
actual operation. I think you all are talking about the same thing. You
should be able to edit, disable, or delete GCP's

Maybe you mean if you edit a GCP, you can 'undo' to put the old coordinates
back? It is easier to add a new one and either disable (i.e., keep it so you
can see it and re-enable it if needed) or delete (get rid of it permanently)
the old one.

But this is just the data-entry frontend [i.points] and nothing to do
with the non-interactive rectifying process [i.rectify] which happens
sometime after the digitizing sessions are done.

The tricky & important interactive task is the warped vector (or sampled
raster 50% alpha'd) overlay as-you-go. In i.vpoints this is in the
analyze menu, the code for it is there, but it doesn't seem to draw for
me (you supposedly can pick order=1,2,3 for that too). Having this
feature working would be a huge plus for GRASS. Esp. if merged with the
experimental auto-GCP code into a single i.uber_points.

Is the analyze function the same in i.points and i.vpoints? If not, what is
the difference?

Thanks
Michael

Michael Barton wrote:

Is the analyze function the same in i.points and i.vpoints? If not, what is
the difference?

i.vpoints uses the CRS_ version, which supports higher-order
transformations.

Note that i.rectify and i.vpoints each have their own private copy of
the CRS_ code, which is also the same code that GDAL uses for
GDALGCPTransform() etc (alg/gdal_crs.c).

Should the imagery modules use GDAL directly, or should we add an
interface in lib/imagery/georef.c?

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

Michael Barton wrote:

It would probably be a good idea to also fold in i.ortho.photo if it is not
too difficult.

Glynn has recommended using the GDAL library for rectification. Could we
fold all raster rectification--general purpose and aerial photo--into
i.rectify with appropriate options and flags? If so, we could add the
additional rectification methods Hamish mentioned in an earlier post.

The rectification aspects of i.orpho.photo should probably remain
separate. AFAIK, it's completely different to the other rectification
methods.

>>> various [Confirm][Cancel] buttons are needed...
>>
>> In most cases, it's preferable to execute operations without
>> confirmation and to provide an undo feature for dealing with mistakes.
>
> Undo is definitely the way to go here.

I'm not sure what undo would mean for georectification. For GRASS, you
always create a new map with georectification. The original, unrectified,
map remains as it was. Same with the GCP file. So undo is kind of
meaningless. Same with confirm and cancel. If the new map doesn't look
right, just delete it, change the existing GCP's, applying them to original
map, and do it again.

My guess is that the confirm/cancel thing is an artifact of using a
Vask/XDRIVER GUI, where the application decides what the user can
change and when. So if the user makes a mistake, the application has
to offer them the option of and correcting it (re-starting the whole
process form scratch isn't a sensible option).

With a "real" (i.e. event-driven) UI, the user can normally change
anything at any time. An undo option may still make sense; e.g. if you
accidentally delete a GCP which took some time to place accurately,
being able to press an undo button is preferable to having to do it
all over again.

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

I don't follow the subtleties of implementing this in C. However, there are
some complications to simply using gdal_transform over GRASS's i.recctify.
So I'm guessing that the last option might be the best.

A question: is this a good point to add a flag to i.rectify to make it
georeference INTO the current location/mapset, rather than georeference OUT
of the current location/mapset? This would be consistent with v.tranform,
r.proj, and v.proj.

A second question: is it better to keep changing i.rectify or to create
"r.rectify" with somewhat different functionality (given all the changes
proposed) and begin to phase out i.rectify?

Finally, I like Hamish's suggestion to have vector georectification conform
to $GISBASE/group/[mapname] structure that i.points and i.rectify now use. I
can pretty easily do this in the georectifier (though it wouldn't be
'enforced' the way it is with i.rectify). However, simulating v.transform
recognizing a group of vector files is a little more complicated. Should I
try to do this or just wait for changes to v.transform?

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Sat, 24 Jun 2006 15:28:22 +0100
To: Michael Barton <michael.barton@asu.edu>
Cc: Hamish <hamish_nospam@yahoo.com>, <rez@touchofmadness.com>, Maciek Sieczka
<werchowyna@epf.pl>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask

Michael Barton wrote:

Is the analyze function the same in i.points and i.vpoints? If not, what is
the difference?

i.vpoints uses the CRS_ version, which supports higher-order
transformations.

Note that i.rectify and i.vpoints each have their own private copy of
the CRS_ code, which is also the same code that GDAL uses for
GDALGCPTransform() etc (alg/gdal_crs.c).

Should the imagery modules use GDAL directly, or should we add an
interface in lib/imagery/georef.c?

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

Glynn,

Do you (or anyone else reading this) know if v.transform will ignore a 5th
column in a points file (i.e., a use gcp column with a value of 0 or 1) or a
5th column will cause it to choke?

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Sat, 24 Jun 2006 15:39:40 +0100
To: Michael Barton <michael.barton@asu.edu>
Cc: <rez@touchofmadness.com>, grass5 <grass-dev@grass.itc.it>, Maciek Sieczka
<werchowyna@epf.pl>, Hamish <hamish_nospam@yahoo.com>
Subject: Re: [GRASS-dev] lib/vask

Michael Barton wrote:

It would probably be a good idea to also fold in i.ortho.photo if it is not
too difficult.

Glynn has recommended using the GDAL library for rectification. Could we
fold all raster rectification--general purpose and aerial photo--into
i.rectify with appropriate options and flags? If so, we could add the
additional rectification methods Hamish mentioned in an earlier post.

The rectification aspects of i.orpho.photo should probably remain
separate. AFAIK, it's completely different to the other rectification
methods.

various [Confirm][Cancel] buttons are needed...

In most cases, it's preferable to execute operations without
confirmation and to provide an undo feature for dealing with mistakes.

Undo is definitely the way to go here.

I'm not sure what undo would mean for georectification. For GRASS, you
always create a new map with georectification. The original, unrectified,
map remains as it was. Same with the GCP file. So undo is kind of
meaningless. Same with confirm and cancel. If the new map doesn't look
right, just delete it, change the existing GCP's, applying them to original
map, and do it again.

My guess is that the confirm/cancel thing is an artifact of using a
Vask/XDRIVER GUI, where the application decides what the user can
change and when. So if the user makes a mistake, the application has
to offer them the option of and correcting it (re-starting the whole
process form scratch isn't a sensible option).

With a "real" (i.e. event-driven) UI, the user can normally change
anything at any time. An undo option may still make sense; e.g. if you
accidentally delete a GCP which took some time to place accurately,
being able to press an undo button is preferable to having to do it
all over again.

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

Michael Barton wrote:

I don't follow the subtleties of implementing this in C. However, there are
some complications to simply using gdal_transform over GRASS's i.recctify.
So I'm guessing that the last option might be the best.

A question: is this a good point to add a flag to i.rectify to make it
georeference INTO the current location/mapset, rather than georeference OUT
of the current location/mapset? This would be consistent with v.tranform,
r.proj, and v.proj.

Yes. I'm not sure whether it should be a flag, or a combination of a
location= option to specify the source location (and either a mapset=
option or allowing group=group@mapset) and making the destination
location/mapset the target for the group.

If the existing mechanism of allowing rectification from the current
location to a given target location is to be retained alongside
rectification from a given source location into the current location,
then you essentially have the ability to rectify from any location to
any other location.

A second question: is it better to keep changing i.rectify or to create
"r.rectify" with somewhat different functionality (given all the changes
proposed) and begin to phase out i.rectify?

Probably. There might still be a need for an i.rectify module, but
there's no reason (AFAICT) why it couldn't just run r.rectify for each
band.

Finally, I like Hamish's suggestion to have vector georectification conform
to $GISBASE/group/[mapname] structure that i.points and i.rectify now use. I
can pretty easily do this in the georectifier (though it wouldn't be
'enforced' the way it is with i.rectify). However, simulating v.transform
recognizing a group of vector files is a little more complicated. Should I
try to do this or just wait for changes to v.transform?

I wouldn't suggest using the group directory solely because that's
where the imagery subsystem stores its state. The imagery subsystem is
quite poorly designed in general, and shouldn't be copied just for
convenience' sake.

E.g. the target/points information appears to be an artifact of the
i.points/i.rectify workflow. Apart from anything else, there doesn't
appear to be any way to have multiple GCP files for a given location
(so you could rectify to multiple locations).

It would make more sense if either the GCP files were a separate type
of entity (like e.g. regions), so you could use the same GCPs on
multiple imagery groups (e.g. if you had images corresponding with the
same view taken at different times), or could have different GCP files
for the same imagery group(s) in different locations. Or if you could
store the projected coordinates in lat/lon then combine i.rectify with
proj to rectify into any given location.

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

Michael Barton wrote:

Do you (or anyone else reading this) know if v.transform will ignore a 5th
column in a points file (i.e., a use gcp column with a value of 0 or 1) or a
5th column will cause it to choke?

It appears that it should work.

v.transform reads a line from the file with fgets() then uses sscanf()
to extract four doubles from it; anything after that is ignored.

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

What is needed is a predictable place to put GCP files--for RMS calculations
(i.e., projected xy or distance between projected xy and specified e/n for
that point) and for rectification.

I'm assuming that you'd need all the GCP's to do the forward projection of
GCP's. What form would you want to return them in?

I think the only things that goes into a $GISBASE/group/[mapname] folder are
a POINTS file with GCP's and a REF file with a list of raster maps to be
rectified with the POINTS file in the directory. Any suggestions for a
location if not $GISBASE/group? If we move the GCP's then i.rectify will
have to be changed or an r.rectify will have to be created to read GCP's
from the new location.

If an r.rectify module could specify an input file for GCP's like
v.transform does, it would be somewhat more flexible and multiple GCP files
can be used and reused for multiple rectifications. That is, a single GCP
file could be used for multiple raster (including image bands) and vector
files.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Sat, 24 Jun 2006 20:37:03 +0100
To: Michael Barton <michael.barton@asu.edu>
Cc: <grass-dev@grass.itc.it>, Maciek Sieczka <werchowyna@epf.pl>, Hamish
<hamish_nospam@yahoo.com>, <rez@touchofmadness.com>
Subject: Re: [GRASS-dev] lib/vask

Michael Barton wrote:

I don't follow the subtleties of implementing this in C. However, there are
some complications to simply using gdal_transform over GRASS's i.recctify.
So I'm guessing that the last option might be the best.

A question: is this a good point to add a flag to i.rectify to make it
georeference INTO the current location/mapset, rather than georeference OUT
of the current location/mapset? This would be consistent with v.tranform,
r.proj, and v.proj.

Yes. I'm not sure whether it should be a flag, or a combination of a
location= option to specify the source location (and either a mapset=
option or allowing group=group@mapset) and making the destination
location/mapset the target for the group.

If the existing mechanism of allowing rectification from the current
location to a given target location is to be retained alongside
rectification from a given source location into the current location,
then you essentially have the ability to rectify from any location to
any other location.

A second question: is it better to keep changing i.rectify or to create
"r.rectify" with somewhat different functionality (given all the changes
proposed) and begin to phase out i.rectify?

Probably. There might still be a need for an i.rectify module, but
there's no reason (AFAICT) why it couldn't just run r.rectify for each
band.

Finally, I like Hamish's suggestion to have vector georectification conform
to $GISBASE/group/[mapname] structure that i.points and i.rectify now use. I
can pretty easily do this in the georectifier (though it wouldn't be
'enforced' the way it is with i.rectify). However, simulating v.transform
recognizing a group of vector files is a little more complicated. Should I
try to do this or just wait for changes to v.transform?

I wouldn't suggest using the group directory solely because that's
where the imagery subsystem stores its state. The imagery subsystem is
quite poorly designed in general, and shouldn't be copied just for
convenience' sake.

E.g. the target/points information appears to be an artifact of the
i.points/i.rectify workflow. Apart from anything else, there doesn't
appear to be any way to have multiple GCP files for a given location
(so you could rectify to multiple locations).

It would make more sense if either the GCP files were a separate type
of entity (like e.g. regions), so you could use the same GCPs on
multiple imagery groups (e.g. if you had images corresponding with the
same view taken at different times), or could have different GCP files
for the same imagery group(s) in different locations. Or if you could
store the projected coordinates in lat/lon then combine i.rectify with
proj to rectify into any given location.

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

Michael Barton wrote:

What is needed is a predictable place to put GCP files--for RMS calculations
(i.e., projected xy or distance between projected xy and specified e/n for
that point) and for rectification.

Or you could just use a filename rather than assuming a specific
location within the mapset directory.

I'm assuming that you'd need all the GCP's to do the forward projection of
GCP's. What form would you want to return them in?

Sorry, I don't understand the question.

I think the only things that goes into a $GISBASE/group/[mapname] folder are
a POINTS file with GCP's and a REF file with a list of raster maps to be
rectified with the POINTS file in the directory. Any suggestions for a
location if not $GISBASE/group? If we move the GCP's then i.rectify will
have to be changed or an r.rectify will have to be created to read GCP's
from the new location.

The most straightforward option is a separate directory, with
arbitrary filenames. Any operation using GCPs would need to take the
name of the GCP file as an option (e.g. "i.rectify ... gcp=...").

An extension would be to create a file in the cell_misc/<mapname>
directory containing the name of a GCP file and the projection details
of the target coordinate system used by that file. This would allow
you to rectify an image into any location.

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

[replies to multiple posts in the thread follow]

Glynn:

My guess is that the confirm/cancel thing is an artifact of using a
Vask/XDRIVER GUI, where the application decides what the user can
change and when. So if the user makes a mistake, the application has
to offer them the option of and correcting it (re-starting the whole
process form scratch isn't a sensible option).

A confirm/cancel button is useful when input coordinates are from the
keyboard (exactitude). Placing points with the mouse isn't a problem-
you can see the error as long as the zoom hasn't changed.

A tooltip containing from,to coordinates on mouse-over a GCP might
help? But I stand by the need for a review & confirm step during tedious
keyboard data-entry sessions. Unless the typo is really bad you probably
won't eyeball a subtle error after hitting <enter>.
x.xxxx<tab>y.yyyyy<enter>[ok? Y/n]<enter>

Random access {delete | disable} of GCPs is required. undo last action
would be nice.

Michael:

Is the analyze function the same in i.points and i.vpoints? If not,
what is the difference?

They differ quite a bit, i.vpoints is much more advanced.
[update to the latest CVS bug fixed version and have a look!]

i.vpoints analyze menu will let you change the transform order (updating
RMS calcs accordingly) and optionally delete GCPs as well as disable
them.

Also very importantly the i.vpoints analyze menu will let you test-
overlay a vector map on your source map so you can see what the result
will look like as-you-go. I don't think this is working currently, but
I think it's an easy fix so will try to get it going in the next days.

I don't have any experience with i.points3, i.points.auto, or
i.ortho.photo so I can't say how they differ. Only that some
rationalization of this functionality is long overdue, and I hope
Michael's new GUI can be that.

Glynn:

Note that i.rectify and i.vpoints each have their own private copy of
the CRS_ code, which is also the same code that GDAL uses for
GDALGCPTransform() etc (alg/gdal_crs.c).

"same code" minus any bug fixes applied to the GDAL version?

Should the imagery modules use GDAL directly, or should we add an
interface in lib/imagery/georef.c?

use GDAL directly please. It will be better cared for.
see
https://intevation.de/rt/webrt?serial_num=3166
https://intevation.de/rt/webrt?serial_num=3296
https://intevation.de/rt/webrt?serial_num=2952

Michael:

A question: is this a good point to add a flag to i.rectify to make it
georeference INTO the current location/mapset,

I prefer a "i.rectify -r" flag to new parameters= or a new r.rectify
module.

Glynn:

I wouldn't suggest using the group directory solely because that's
where the imagery subsystem stores its state. The imagery subsystem is
quite poorly designed in general, and shouldn't be copied just for
convenience' sake.

FWIW, I think after you get used to it, it works very well for its
assigned task. And there is great value in maintaining consistency in
non-broken systems. Could you explain what you perceive the deficiencies
to be in the current system?

Glynn:

E.g. the target/points information appears to be an artifact of the
i.points/i.rectify workflow.

having GCP data in an easily parsable plain text file is highly
desirable. I see no reason why a $MAPSET/group/$GROUP/points file isn't
the perfect place for this.

Glynn:

Apart from anything else, there doesn't appear to be any way to have
multiple GCP files for a given location (so you could rectify to
multiple locations).

um, define multiple groups?

Glynn:

It would make more sense if either the GCP files were a separate type
of entity (like e.g. regions), so you could use the same GCPs on
multiple imagery groups (e.g. if you had images corresponding with the
same view taken at different times),

this is just the concept of the "group" and "subgroup" restated !!?

see the GRASS 5 i.group man page. (much info didn't get ported
apparently)
http://grass.ibiblio.org/grass53/manuals/html53_user/html/i.group.html

Adding maps to a new group is trival versus setting GCPs. Managing GCP
sets needs to be the core feature, not a tag-on file.

this should be updated and html-ized for GRASS 6:
http://grass.ibiblio.org/grass53/manuals/html53_user/Postscript/imagery.ps

G:

or could have different GCP files for the same imagery group(s) in
different locations.

adding maps to the group isn't a hard task and could be easily scripted.

G:

Or if you could store the projected coordinates in lat/lon then
combine i.rectify with proj to rectify into any given location.

interesting. but in practice will the result be that much better than
the current i.rectify+r.proj way?

Glynn:

Or you could just use a filename rather than assuming a specific
location within the mapset directory.

why make it so fragile? This file is an in-between file between the
interactive GCP editor and the rectifying backend. There is no need to
make it custom file which will get scattered and lost.

Sorry if I sound a bit frustrated, but to me it seems that there is a
lot of reinventing the wheel v1.0 here with little additional benefit.
What is so broken about the imagery system to justify a major overhaul
which will leave us with the same feature set, "but different"? It
borders on not-built-here syndrome. I don't see a compelling need for
anything other than a new i.points GUI which includes some included tabs
that act as a frontend to i.target+i.group setting and a big red
"rectify" button which becomes active once all needed info is correctly
filled in.

regards,
Hamish

Hamish wrote:

[replies to multiple posts in the thread follow]

Glynn:
> My guess is that the confirm/cancel thing is an artifact of using a
> Vask/XDRIVER GUI, where the application decides what the user can
> change and when. So if the user makes a mistake, the application has
> to offer them the option of and correcting it (re-starting the whole
> process form scratch isn't a sensible option).

A confirm/cancel button is useful when input coordinates are from the
keyboard (exactitude). Placing points with the mouse isn't a problem-
you can see the error as long as the zoom hasn't changed.

A tooltip containing from,to coordinates on mouse-over a GCP might
help? But I stand by the need for a review & confirm step during tedious
keyboard data-entry sessions. Unless the typo is really bad you probably
won't eyeball a subtle error after hitting <enter>.
x.xxxx<tab>y.yyyyy<enter>[ok? Y/n]<enter>

Personally, I don't think that the confirmation will change much; the
user will just habitually press Y every time.

Glynn:
> Note that i.rectify and i.vpoints each have their own private copy of
> the CRS_ code, which is also the same code that GDAL uses for
> GDALGCPTransform() etc (alg/gdal_crs.c).

"same code" minus any bug fixes applied to the GDAL version?

They all appear to derive from a common ancestor. I daresay that
individual versions will have changes which only apply to that version
(and anything which was cloned from it after the change was made).

Michael:
> A question: is this a good point to add a flag to i.rectify to make it
> georeference INTO the current location/mapset,

I prefer a "i.rectify -r" flag to new parameters= or a new r.rectify
module.

How about extending [rv].proj to support GCP-based transformations as
an alternative to those provided by proj? Or even building this into
the gproj library?

Glynn:
> I wouldn't suggest using the group directory solely because that's
> where the imagery subsystem stores its state. The imagery subsystem is
> quite poorly designed in general, and shouldn't be copied just for
> convenience' sake.

FWIW, I think after you get used to it, it works very well for its
assigned task. And there is great value in maintaining consistency in
non-broken systems. Could you explain what you perceive the deficiencies
to be in the current system?

Primarily inconsistency; almost every other GRASS module writes data
only to the current mapset. [Does i.rectify actually bother to lock
the current mapset before modifying it?]

It isn't beyond the realms of possibility that future changes will
make writing to a mapset other than the current one even more
problematic than it is at present.

Glynn:
> E.g. the target/points information appears to be an artifact of the
> i.points/i.rectify workflow.

having GCP data in an easily parsable plain text file is highly
desirable.

That isn't in dispute.

I see no reason why a $MAPSET/group/$GROUP/points file isn't
the perfect place for this.

It might help if I understood exactly what a "group" is meant to be. I
know what raster/vector maps are, what regions are etc, but I'm
unclear on what a group /is/ (if it is anything other than a saved
i.points/i.rectify "session").

> Apart from anything else, there doesn't appear to be any way to have
> multiple GCP files for a given location (so you could rectify to
> multiple locations).

um, define multiple groups?

Which seems like a workaround for the fact that a one-to-one mapping
is being used for something which should arguably be a one-to-many
mapping. IOW, each group only provides one "slot" for GCPs, so you
have to clone the entire group just to get another slot.

> It would make more sense if either the GCP files were a separate type
> of entity (like e.g. regions), so you could use the same GCPs on
> multiple imagery groups (e.g. if you had images corresponding with the
> same view taken at different times),

this is just the concept of the "group" and "subgroup" restated !!?

Is there any advantage to that structure over having a separate
location for each group? If you have multiple groups in a single
location, what do they have in common?

The nature of a location is that everything within it shares a common
coordinate system, so it is meaningful to perform processes which
operate upon multiple maps within the same location.

see the GRASS 5 i.group man page. (much info didn't get ported
apparently)
http://grass.ibiblio.org/grass53/manuals/html53_user/html/i.group.html

Adding maps to a new group is trival versus setting GCPs. Managing GCP
sets needs to be the core feature, not a tag-on file.
this should be updated and html-ized for GRASS 6:
http://grass.ibiblio.org/grass53/manuals/html53_user/Postscript/imagery.ps

G:
> or could have different GCP files for the same imagery group(s) in
> different locations.

adding maps to the group isn't a hard task and could be easily scripted.

So, you're saying that a group is essentially a GCP file plus some
other data (e.g. a set of maps) tacked on?

The whole structure sounds like little more than a mechanism to bundle
various parameters together into a "current state".

G:
> Or if you could store the projected coordinates in lat/lon then
> combine i.rectify with proj to rectify into any given location.

interesting. but in practice will the result be that much better than
the current i.rectify+r.proj way?

Both i.rectify and r.proj introduce sampling errors; two separate
steps will produce double the error of a single step.

Sorry if I sound a bit frustrated, but to me it seems that there is a
lot of reinventing the wheel v1.0 here with little additional benefit.
What is so broken about the imagery system to justify a major overhaul
which will leave us with the same feature set, "but different"? It
borders on not-built-here syndrome. I don't see a compelling need for
anything other than a new i.points GUI which includes some included tabs
that act as a frontend to i.target+i.group setting and a big red
"rectify" button which becomes active once all needed info is correctly
filled in.

The GRASS database directory is supposed to be a database of
geospatial information, not a place for individual applications to
store their session files.

For a trivial program, you don't have to give much consideration to
how data is structured. As a system becomes more complex and provides
greater functionality, it becomes more important for data to be
structured correctly.

I'm not sure what benefit the concept of imagery groups provides
beyond that provided by locations. Maybe whoever came up with it
didn't have write permission on the database directory and couldn't
create new locations, so they decided to create a separate hierarchy
using the current mapset as a database directory?

If a group is essentially a collection of maps having the same
coordinate system, then it's just duplicating the location concept.

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

Glynn and Hamish,

Here are a couple of possibly clarifying things and suggestions responding
to the various items below.

GROUP:
Just an list of raster maps that will be rectified by a single set of GCP's.
A group directory stores the ascii list of maps to be rectified (REF file),
the ascii file of GCP's to use (POINTS file), and an ascii file with the
mapset and location (TARGET file) that the maps will be rectified and
reprojected into.

If i.rectify (or r.rectify or g.rectify) could be made to work like
v.transform, v.proj, and r.proj (i.e., rectify INTO the current mapset),
then we could dispense with the target file.

A list of maps, raster or vector, to rectify at the same time and with the
same set of GCP's is handy. However, if i.rectify/r.rectify allowed you to
simply specify the GCP file to use, rather than entire group, then you could
use a single GCP file to rectify lots of different maps--or just a single
one--without having to first build the REF file.

So here's the suggestion. Just have a rectification algorithim (I'm liking
g.rectify better) look for a user specified POINTS file (like v.transform)
in a standard location (like i.rectify) in a source mapset and location
(specified like in v.proj and r.proj) and rectify into the current mapset.

One module would do both raster and vector, work in a manner consistent with
v.proj and r.proj, allow for alternate rectification algorithms, and allow a
POINTS file to be used with multiple raster and vector files.

How does this sound.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Mon, 26 Jun 2006 13:41:32 +0100
To: Hamish <hamish_nospam@yahoo.com>
Cc: <michael.barton@asu.edu>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask [i.points replacement]

Hamish wrote:

[replies to multiple posts in the thread follow]

Glynn:

My guess is that the confirm/cancel thing is an artifact of using a
Vask/XDRIVER GUI, where the application decides what the user can
change and when. So if the user makes a mistake, the application has
to offer them the option of and correcting it (re-starting the whole
process form scratch isn't a sensible option).

A confirm/cancel button is useful when input coordinates are from the
keyboard (exactitude). Placing points with the mouse isn't a problem-
you can see the error as long as the zoom hasn't changed.

A tooltip containing from,to coordinates on mouse-over a GCP might
help? But I stand by the need for a review & confirm step during tedious
keyboard data-entry sessions. Unless the typo is really bad you probably
won't eyeball a subtle error after hitting <enter>.
x.xxxx<tab>y.yyyyy<enter>[ok? Y/n]<enter>

Personally, I don't think that the confirmation will change much; the
user will just habitually press Y every time.

Glynn:

Note that i.rectify and i.vpoints each have their own private copy of
the CRS_ code, which is also the same code that GDAL uses for
GDALGCPTransform() etc (alg/gdal_crs.c).

"same code" minus any bug fixes applied to the GDAL version?

They all appear to derive from a common ancestor. I daresay that
individual versions will have changes which only apply to that version
(and anything which was cloned from it after the change was made).

Michael:

A question: is this a good point to add a flag to i.rectify to make it
georeference INTO the current location/mapset,

I prefer a "i.rectify -r" flag to new parameters= or a new r.rectify
module.

How about extending [rv].proj to support GCP-based transformations as
an alternative to those provided by proj? Or even building this into
the gproj library?

Glynn:

I wouldn't suggest using the group directory solely because that's
where the imagery subsystem stores its state. The imagery subsystem is
quite poorly designed in general, and shouldn't be copied just for
convenience' sake.

FWIW, I think after you get used to it, it works very well for its
assigned task. And there is great value in maintaining consistency in
non-broken systems. Could you explain what you perceive the deficiencies
to be in the current system?

Primarily inconsistency; almost every other GRASS module writes data
only to the current mapset. [Does i.rectify actually bother to lock
the current mapset before modifying it?]

It isn't beyond the realms of possibility that future changes will
make writing to a mapset other than the current one even more
problematic than it is at present.

Glynn:

E.g. the target/points information appears to be an artifact of the
i.points/i.rectify workflow.

having GCP data in an easily parsable plain text file is highly
desirable.

That isn't in dispute.

I see no reason why a $MAPSET/group/$GROUP/points file isn't
the perfect place for this.

It might help if I understood exactly what a "group" is meant to be. I
know what raster/vector maps are, what regions are etc, but I'm
unclear on what a group /is/ (if it is anything other than a saved
i.points/i.rectify "session").

Apart from anything else, there doesn't appear to be any way to have
multiple GCP files for a given location (so you could rectify to
multiple locations).

um, define multiple groups?

Which seems like a workaround for the fact that a one-to-one mapping
is being used for something which should arguably be a one-to-many
mapping. IOW, each group only provides one "slot" for GCPs, so you
have to clone the entire group just to get another slot.

It would make more sense if either the GCP files were a separate type
of entity (like e.g. regions), so you could use the same GCPs on
multiple imagery groups (e.g. if you had images corresponding with the
same view taken at different times),

this is just the concept of the "group" and "subgroup" restated !!?

Is there any advantage to that structure over having a separate
location for each group? If you have multiple groups in a single
location, what do they have in common?

The nature of a location is that everything within it shares a common
coordinate system, so it is meaningful to perform processes which
operate upon multiple maps within the same location.

see the GRASS 5 i.group man page. (much info didn't get ported
apparently)
http://grass.ibiblio.org/grass53/manuals/html53_user/html/i.group.html

Adding maps to a new group is trival versus setting GCPs. Managing GCP
sets needs to be the core feature, not a tag-on file.
this should be updated and html-ized for GRASS 6:
http://grass.ibiblio.org/grass53/manuals/html53_user/Postscript/imagery.ps

G:

or could have different GCP files for the same imagery group(s) in
different locations.

adding maps to the group isn't a hard task and could be easily scripted.

So, you're saying that a group is essentially a GCP file plus some
other data (e.g. a set of maps) tacked on?

The whole structure sounds like little more than a mechanism to bundle
various parameters together into a "current state".

G:

Or if you could store the projected coordinates in lat/lon then
combine i.rectify with proj to rectify into any given location.

interesting. but in practice will the result be that much better than
the current i.rectify+r.proj way?

Both i.rectify and r.proj introduce sampling errors; two separate
steps will produce double the error of a single step.

Sorry if I sound a bit frustrated, but to me it seems that there is a
lot of reinventing the wheel v1.0 here with little additional benefit.
What is so broken about the imagery system to justify a major overhaul
which will leave us with the same feature set, "but different"? It
borders on not-built-here syndrome. I don't see a compelling need for
anything other than a new i.points GUI which includes some included tabs
that act as a frontend to i.target+i.group setting and a big red
"rectify" button which becomes active once all needed info is correctly
filled in.

The GRASS database directory is supposed to be a database of
geospatial information, not a place for individual applications to
store their session files.

For a trivial program, you don't have to give much consideration to
how data is structured. As a system becomes more complex and provides
greater functionality, it becomes more important for data to be
structured correctly.

I'm not sure what benefit the concept of imagery groups provides
beyond that provided by locations. Maybe whoever came up with it
didn't have write permission on the database directory and couldn't
create new locations, so they decided to create a separate hierarchy
using the current mapset as a database directory?

If a group is essentially a collection of maps having the same
coordinate system, then it's just duplicating the location concept.

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

Glynn and Hamish,

One more thought. Because the GRASS database is a set of geospatial
information for a particular projection (location) and set of maps/images
(mapset), storing GCP's for the geospatial data with that projection in the
GRASS database is a reasonable thing to do.

However, we do need to keep track of the target location for a particular
GCP POINTS file--either in the GCP file itself, or in a separate ascii file
like we have now. This is one argument for keeping at least the
$GISBASE/group/ structure. However, it might make more sense if each
directory under $GISBASE/group/ represents a target location (it could have
multiple GCP files) rather than the way it is now with a single target,
single POINTS file, and list of maps.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Mon, 26 Jun 2006 13:41:32 +0100
To: Hamish <hamish_nospam@yahoo.com>
Cc: <michael.barton@asu.edu>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask [i.points replacement]

The GRASS database directory is supposed to be a database of
geospatial information, not a place for individual applications to
store their session files.

Michael Barton wrote:

Here are a couple of possibly clarifying things and suggestions responding
to the various items below.

GROUP:
Just an list of raster maps that will be rectified by a single set of GCP's.
A group directory stores the ascii list of maps to be rectified (REF file),
the ascii file of GCP's to use (POINTS file), and an ascii file with the
mapset and location (TARGET file) that the maps will be rectified and
reprojected into.

If i.rectify (or r.rectify or g.rectify) could be made to work like
v.transform, v.proj, and r.proj (i.e., rectify INTO the current mapset),
then we could dispense with the target file.

A list of maps, raster or vector, to rectify at the same time and with the
same set of GCP's is handy. However, if i.rectify/r.rectify allowed you to
simply specify the GCP file to use, rather than entire group, then you could
use a single GCP file to rectify lots of different maps--or just a single
one--without having to first build the REF file.

So here's the suggestion. Just have a rectification algorithim (I'm liking
g.rectify better) look for a user specified POINTS file (like v.transform)
in a standard location (like i.rectify) in a source mapset and location
(specified like in v.proj and r.proj) and rectify into the current mapset.

One module would do both raster and vector, work in a manner consistent with
v.proj and r.proj, allow for alternate rectification algorithms, and allow a
POINTS file to be used with multiple raster and vector files.

How does this sound.

Firstly, at the lowest level, the utility should allow the use of an
arbitrary GCP file (i.e. no restrictions on the name or location of
the file). Given that, it would be trivial to construct a script which
calls the utility for a GCP file with a specific name and location.

I'm not so sure about a single module for both rasters and vectors.
There are significant differences between projecting the two; e.g.
rasters use the backward projection but vectors the forward
projection, rasters can use various interpolation methods, etc.

My inclination would be to either extend r.proj and v.proj to support
GCP-based transformations as well as those provided by the proj
library, or to extend the gproj library itself.

As for processing multiple maps: the calculations involved in
computing the projection from the GCPs are trivial (in terms of CPU
usage) compared to the actual projection. It wouldn't be noticeably
less efficient to have a script call the projection utility once for
each map.

If you had an r.rectify command (or an extended r.proj) which
rectified a single map using an explictly-specified GCP file, it
shouldn't be much work to re-implement i.rectify as a script which
runs r.rectify on each map in the REF file, using the POINTS file from
the "group" directory.

Rectifying /out/ of the current mapset might be tricker, but that
particular behaviour is arguably a bug which should be fixed.

Aside:

I've wondered whether it would be worth having a general-purpose
"g.multi" command which executes a command "template" on multiple
maps. This first occurred to me in the context of handling colour
images as R/G/B channels; i.e. having a g.rgb command which would be
used like e.g. "g.rgb r.rescale in=inmap.% out=outmap.% ...", where
the % would be replaced with r/g/b on each run.

The main reason for not implementing it at that time was that, on the
one hand, it should probably be made more general, but on the other
hand, a more general version would require various options, and you
can't (currently) use G_parser() for a command which has an open-ended
list of options. Thus it would be necessary to extend G_parser() to
allow unknown options to be accepted.

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

From: Glynn Clements <glynn@gclements.plus.com>
Date: Tue, 27 Jun 2006 16:49:51 +0100
To: Michael Barton <michael.barton@asu.edu>
Cc: Hamish <hamish_nospam@yahoo.com>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] lib/vask [i.points replacement]

As for processing multiple maps: the calculations involved in
computing the projection from the GCPs are trivial (in terms of CPU
usage) compared to the actual projection. It wouldn't be noticeably
less efficient to have a script call the projection utility once for
each map.

If you had an r.rectify command (or an extended r.proj) which
rectified a single map using an explictly-specified GCP file, it
shouldn't be much work to re-implement i.rectify as a script which
runs r.rectify on each map in the REF file, using the POINTS file from
the "group" directory.

I was thinking of having it work more like g.remove. You could simply list a
set of maps in the input argument. e.g.,

r.rectify input=map[,map,map,...] points=file location=source_location
mapset=source_mapset method=[method (default to 1st order)]

either have a v.rectify that works the same way (currently v.transform only
works with maps in the same mapset for source and target) or have a
g.rectify that would replace input= with vect= and rast=

Rectifying /out/ of the current mapset might be tricker, but that
particular behaviour is arguably a bug which should be fixed.

agreed

Aside:

I've wondered whether it would be worth having a general-purpose
"g.multi" command which executes a command "template" on multiple
maps. This first occurred to me in the context of handling colour
images as R/G/B channels; i.e. having a g.rgb command which would be
used like e.g. "g.rgb r.rescale in=inmap.% out=outmap.% ...", where
the % would be replaced with r/g/b on each run.

Interesting, but is this necessary when you can have multiple inputs?

Michael

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Glynn Clements wrote:

Aside:

I've wondered whether it would be worth having a general-purpose
"g.multi" command which executes a command "template" on multiple
maps. This first occurred to me in the context of handling colour
images as R/G/B channels; i.e. having a g.rgb command which would be
used like e.g. "g.rgb r.rescale in=inmap.% out=outmap.% ...", where
the % would be replaced with r/g/b on each run.

The main reason for not implementing it at that time was that, on the
one hand, it should probably be made more general, but on the other
hand, a more general version would require various options, and you
can't (currently) use G_parser() for a command which has an open-ended
list of options. Thus it would be necessary to extend G_parser() to
allow unknown options to be accepted.

some modules output to map.r map.g map.b, and some to map.1 map.2 map.3.
not so general :-/

I've never fully understood the use of "file {cell,cellhd}"
could something like that be used?

In the mean time,
  for MAP in `g.mlist pat=[regex]` ; do
    ..
  done
is very nice for these tasks.

Hamish