basic projection question

Date: Wed, 7 Jul 93 15:53:37 -0500
From: Darrell McCauley <mccauley@ecn.purdue.edu>
Sender: mccauley@ecn.purdue.edu
To: grassp-list@max.cecer.army.mil
In-Reply-To: <9307071359.AA01312@charon.er.usgs.gov>
Subject: Re: basic projection question

Gerald I. Evenden (gie@charon.er.usgs.gov) writes on 7 Jul 93:

You have totally lost me.

and you were the only reply :frowning:

Let me re-phrase the question. Forget about spheres
and ellipsoids and earth for a second. I am coding up
an algorithm that was written for points in a plane
(call it x-y). A line extends through two points,
(x1,y1) and (x2,y2), both of which are in the first
quadrant of a Cartesian coordinate system. This line
crosses the y-axis at some point. The angle 't'
between the line and the axis is what I am interested
in.

    | * (x2, y2)
    | /
    | /
    | * (x1, y2)
    | /
    | /
    -----------------------
    | /
    | /
    |t /
    | /
    |/
    |
   /|
  / |

Calculation of the angle is straightforward in the
x-y plane.

Certainly, the above is clear and elementary as long as we are
discussing a cartesian system.

           Now enter the complexities of geo
referenced data, an funny-shaped earth, etc. How would
this angle be calculated using GRASS library
functions? (Assuming that the data is in one of
the supported coordinate systesms.)

We are starting to issue several buzz words here and I think we need to
clarify our dictionaries. We talk about "geo referenced data" and
"supported coordinate systems" and I am not sure what exactly you mean.
As far as I am concerned there are two basic systems for describing
a geographic point: the common spherical system using latitude, longitude
and height above the geoid and the x-y-z system usually associated with
satelite computations. There are different datums or origin references
but I don't think you are concerned with these.

I am interpreting the phrase "supported coodinate systems" as really
meaning *transformations* between geographic coordinates and a
cartesian x-y system. Certainly, UTM is one of the most common GRASS
transformations used and if you include the proj system that comes with
GRASS, there are at least 75 more that are also supported.

I suspect that most users of this program that I'm
writing will never have anything by x-y

                  ~~
                                  but ?

(unreferenced) data, but I was hoping to do what
is right-n-proper by including support for lat-long
data.

"Unreferenced data?" What do you mean?

I must assume by that sentence that you expect users to have cartesian
data for which they have no idea what the relationship is to the
geographic (lat-lon) coordinate system and how to transform such data
to same. I hope this is not true, for if it is, I fail to see any
value in the data.

--Darrell

Getting back to the angle per se. Given that the angle is computed
in the cartesian system, what is its purpose in the geographic system?
Very few cartesian systems will give the above angular determination
any special significant in geographic space. One case where it will,
is for the Mercator projection where what you have described is a
rhumb line and its azimuth. That's why the Mercator projection is
still used for navigation charts. But outside of navigation, I don't
think many users are interested in rhumb lines.

One of us just doesn't understand the problem.

Gerald (Jerry) I. Evenden Internet: gie@charon.er.usgs.gov
voice: (508)563-6766 Postal: P.O. Box 1027
  fax: (508)457-2310 N.Falmouth, MA 02556-1027

Gerald I. Evenden (gie@charon.er.usgs.gov) writes on 7 Jul 93:

[description of computing magnitude and direction of a vector
deleted]

Certainly, the above is clear and elementary as long as we are
discussing a cartesian system.

           Now enter the complexities of geo
referenced data, an funny-shaped earth, etc. How would
this angle be calculated using GRASS library
functions? (Assuming that the data is in one of
the supported coordinate systesms.)

We are starting to issue several buzz words here and I think we need to
clarify our dictionaries. We talk about "geo referenced data" and
"supported coordinate systems" and I am not sure what exactly you mean.

coordinate system:
        x,y (for imagery and other unreferenced data)
        UTM
        State Plane
        Latitude-Longitude
        other projection

"Unreferenced data?" What do you mean?

What I mean is that they have it in some arbitrary cartesian
system, e.g., the fence post or mail box is the origin. See
x,y coordinate system (above).

I must assume by that sentence that you expect users to have cartesian
data for which they have no idea what the relationship is to the
geographic (lat-lon) coordinate system and how to transform such data
to same. I hope this is not true, for if it is, I fail to see any
value in the data.

they may have an idea of how to transform, but it is not their
intention to do so (the fence post is not going anywhere - getting
a GPS or some other device to determine it's absolute position
on the planet is not necessary).

Anyhow, I think that we may be thinking on completely different
scales... for example, one dataset that I'm working with is only
100 ft x 250 ft in total area. That's smaller than most potential
users would consider, but I hope it conveys the general idea. I'm
not going to defend the *value* of data.

Getting back to the angle per se. Given that the angle is computed
in the cartesian system, what is its purpose in the geographic system?

huh? The angle is not something that I will store permanently in the
system... it is only used to separate and group points that are apart
by a specified vector. Hence, I calculate a magnitude and direction.
It's just for an element of a statistical interpolation algorithm
(called semivariance modeling).

One of us just doesn't understand the problem.

Second restatement (someone help - I must not be conveying this
correctly). This is probably more detail than is useful, but
I must be leaving something out somewhere.

  1. I calculate the following statistic for x,y,z data:
     (x and y are location - z is perhaps an elevation,
      or a concentration, or whatever).

     for all points separated by the vector h,
        sum the squared differences in z values
        and divide by the number of sample points.
     call this value '2G'.

     do this again for another vector (the same
     direction as h, but with the magnitude incremented).

     This gives values of '2G' at several increments
     of the magnitude of h (called "lags").

     Plot values of '2G' on one axis and ||h|| on another
     axis. This is called a variogram.

  2. I want to code this into GRASS as a sites program. Some
     users may have some data that's not in an x,y coordinate
     system, and I'd my program to be able to deal with this.

  3. As I understand it, distances are calculated like so:
     G_begin_distance_calculations();
     G_distance (x1, y1, x2, y2);
     This gets me the magnitude of h - G_distance is supposedly
     smart enough to take care of the details.

  4. WHAT GRASS LIBRARY FUNCTIONS SHOULD I USE SO THAT I CALCULATE
     THE ANGLE OF h?

--Darrell