# basic projection question

Darrell McCauley mccauley at ecn.purdue.edu
Wed Jul 7 23:05:32 EDT 1993

```Gerald I. Evenden (gie at 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

```