[GRASS5] Another question on the projection transform

Hi all,

I have another question on the projection transform.
Does the function in m.proj can be accessed throught
the libgis.a? I mean does there existing the common
API in the grass library which can be directly used
to do some projection transform, for example, i can
specify what the input projection ,input lat/long and
the output projection with the ellipsoids, and the
function can return the output northing/easting?

Thanks,

shifeng

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com

zhang ji wrote:

I have another question on the projection transform.
Does the function in m.proj can be accessed throught
the libgis.a? I mean does there existing the common
API in the grass library which can be directly used
to do some projection transform, for example, i can
specify what the input projection ,input lat/long and
the output projection with the ellipsoids, and the
function can return the output northing/easting?

Most of GRASS' projection handling is implemented via the PROJ library
(src/libes/proj), although there are some simple functions related to
the location's projection in src/libes/gis/proj[123].c.

The best place to find clues as to how to perform projections would
probably be the source code of the [rvsm].proj programs.

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

On Thu, 24 Jan 2002 20:49:36 -0800 (PST), zhang ji <zsfunl@yahoo.com> wrote:

Hi all,

I have another question on the projection transform.
Does the function in m.proj can be accessed throught
the libgis.a? I mean does there existing the common
API in the grass library which can be directly used
to do some projection transform, for example, i can
specify what the input projection ,input lat/long and
the output projection with the ellipsoids, and the
function can return the output northing/easting?

Yes/No. The functions are there, the interface is
messy (mostly a wrapper around a version of proj4).
Note, datum transformations need extra work and
aren't done by default (even if they should be,
when possible). Some of the info is documented
in the GRASS docs, some of it in the PROJ4 docs,
and some of it only in the source code...

If you just need to project or inverse project
a set of coordinates, you might just use the
"proj" command directly (comes with the proj4
library, if you have it installed -- not the
one with GRASS).

An alternative library, independent of GRASS,
is available here:
http://pweb.jps.net/~egm2/libgeotrans/index.html
I pulled out the "library" parts of the GEOTRANS
coordinate calculator, and organized it as a
library. Don't ask me for any help with using
it though, as I haven't really done anything
with it. It has a pretty clean interface, and
will do datum transformations (mostly 3-parameter,
nothing as accurate as NADCON). It does not
support as many projections as proj4, though
the most common ones are there (and some probably
only used by the military).

It has what I consider a couple flaws in how it
deals with it's shared data, the most significant
of which leads to a long initialization time. The
other of which is a security, common vs. per user
data issue (not a problem if you don't let users
define their own datums).

--
Eric G. Miller <egm2@jps.net>

On Thu, Jan 24, 2002 at 08:49:36PM -0800, zhang ji wrote:

Hi all,

I have another question on the projection transform.
Does the function in m.proj can be accessed throught
the libgis.a? I mean does there existing the common
API in the grass library which can be directly used
to do some projection transform, for example, i can
specify what the input projection ,input lat/long and
the output projection with the ellipsoids, and the
function can return the output northing/easting?

Hi,

you may have a look at g.region code, -l flag. It
reads the current region boundary coordinates in
current projection and transforms to latitude-longitude.
Using the PROJ functions as done there you can
re-project values in a program. Also r.sunmask is
using some PROJ functions.

You have to include
$(GPROJLIB)
into the LIBES line of Gmakefile.

A command line version is m.proj2 for shell scripts.

Markus