Skip to content

Commit

Permalink
1.0.7: Transverse Mercator
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Jul 22, 2022
1 parent 6e9ec0d commit bd04a58
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 17 deletions.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ DOCS=/usr/share/doc/helmert3d
BINS=bin
EXAMPS=examples
ELLIPS=ellipsoids
ZONES=zones
MANS=man/man1

all: helmert3d helmparms3d helmdiff3d helmeltrans
all: helmert3d helmparms3d helmdiff3d helmeltrans helmtmerc

libsvdm.a: $(SRCS)/svdm.c
$(CC) $(CFLAGS) -c -o $(SRCS)/svdm.o $^
Expand All @@ -31,6 +32,9 @@ helmdiff3d: $(SRCS)/helmdiff3d.c
helmeltrans: $(SRCS)/helmeltrans.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

helmtmerc: $(SRCS)/helmtmerc.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

pdfman: # not working for win
groff -m man -T ps $(MANS)/helmert3d.1 > man_helmert3d.ps
ps2pdf man_helmert3d.ps man_helmert3d.pdf
Expand All @@ -40,20 +44,24 @@ pdfman: # not working for win
ps2pdf man_helmdiff3d.ps man_helmdiff3d.pdf
groff -m man -T ps $(MANS)/helmeltrans.1 > man_helmeltrans.ps
ps2pdf man_helmeltrans.ps man_helmeltrans.pdf
groff -m man -T ps $(MANS)/helmtmerc.1 > man_helmtmerc.ps
ps2pdf man_helmtmerc.ps man_helmtmerc.pdf
$(RM) *.ps

clean: # not working for win
$(RM) helmparms3d helmert3d helmdiff3d helmeltrans libsvdm.a $(SRCS)/svdm.o *.pdf
$(RM) helmparms3d helmert3d helmdiff3d helmeltrans helmtmerc libsvdm.a $(SRCS)/svdm.o *.pdf

install:
$(INSTALL) -d $(PREFIX)/$(BINS)
$(INSTALL) -d $(PREFIX)/$(MANS)
$(INSTALL) -d $(DOCS)/$(EXAMPS)
$(INSTALL) -d $(DOCS)/$(ELLIPS)
$(INSTALL) -d $(DOCS)/$(ZONES)
$(INSTALL) -m 0755 helmparms3d $(PREFIX)/$(BINS)
$(INSTALL) -m 0755 helmert3d $(PREFIX)/$(BINS)
$(INSTALL) -m 0755 helmdiff3d $(PREFIX)/$(BINS)
$(INSTALL) -m 0755 helmeltrans $(PREFIX)/$(BINS)
$(INSTALL) -m 0755 helmtmerc $(PREFIX)/$(BINS)
$(INSTALL) -m 0644 README.md $(DOCS)
$(INSTALL) -m 0644 LICENSE $(DOCS)
$(INSTALL) -m 0644 common_ellipsoids.txt $(DOCS)
Expand All @@ -66,18 +74,23 @@ install:
$(INSTALL) -m 0644 $(ELLIPS)/KRASOVSKIY.txt $(DOCS)/$(ELLIPS)
$(INSTALL) -m 0644 $(ELLIPS)/PZ90.txt $(DOCS)/$(ELLIPS)
$(INSTALL) -m 0644 $(ELLIPS)/WGS84.txt $(DOCS)/$(ELLIPS)
$(INSTALL) -m 0644 $(ZONES)/6d4zone.txt $(DOCS)/$(ZONES)
$(INSTALL) -m 0644 $(ZONES)/6d4zonespec.txt $(DOCS)/$(ZONES)
$(INSTALL) -m 0644 $(MANS)/helmparms3d.1 $(PREFIX)/$(MANS)
$(INSTALL) -m 0644 $(MANS)/helmert3d.1 $(PREFIX)/$(MANS)
$(INSTALL) -m 0644 $(MANS)/helmdiff3d.1 $(PREFIX)/$(MANS)
$(INSTALL) -m 0644 $(MANS)/helmeltrans.1 $(PREFIX)/$(MANS)
$(INSTALL) -m 0644 $(MANS)/helmtmerc.1 $(PREFIX)/$(MANS)

uninstall:
$(RM) $(PREFIX)/$(BINS)/helmparms3d
$(RM) $(PREFIX)/$(BINS)/helmert3d
$(RM) $(PREFIX)/$(BINS)/helmdiff3d
$(RM) $(PREFIX)/$(BINS)/helmeltrans
$(RM) $(PREFIX)/$(BINS)/helmtmerc
$(RMD) $(DOCS)
$(RM) $(PREFIX)/$(MANS)/helmparms3d.1
$(RM) $(PREFIX)/$(MANS)/helmert3d.1
$(RM) $(PREFIX)/$(MANS)/helmdiff3d.1
$(RM) $(PREFIX)/$(MANS)/helmeltrans.1
$(RM) $(PREFIX)/$(MANS)/helmtmerc.1
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ Coordinate system translatation:
helmeltrans {blh|xyz} src_infilename ellipsoid_infilename [outfilename]
```

Transverse Mercator:
```sh
helmtmerc {blh|xyh} src_infilename ellipsoid_infilename zone_infilename [outfilename]
```

Test:
```sh
helmdiff3d xyz_dest_infilename xyz_transformed_infilename [xyz_diff_outfilename]
Expand Down Expand Up @@ -118,11 +123,24 @@ BLH data file format:
B[n] L[n] H[n]
```

xyH data file format:
```
x[1] y[1] H[1]
.. .. ..
.. .. ..
x[n] y[n] H[n]
```

Ellipsoid data file format:
```
name a b
```

Zone data file format:
```
zone_size zone_number [zone_scale] [L0] [x0] [y0]
```

See ellipsoids : [Common Ellipsoids](./common_ellipsoids.txt)

----
Expand Down
5 changes: 3 additions & 2 deletions man/man1/helmdiff3d.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "helmdiff3d" 1 1.0.4 "27 Nov 2021" "User Manual"
.TH "helmdiff3d" 1 1.0.7 "22 Jul 2022" "User Manual"

.SH NAME
helmdiff3d
Expand Down Expand Up @@ -49,7 +49,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.SH SEE ALSO
helmparms3d(1),
helmert3d(1),
helmeltrans(1)
helmeltrans(1),
helmtmerc(1)

.SH CONTACT
Website: https://github.com/dr-ni/helmert3d
Expand Down
7 changes: 4 additions & 3 deletions man/man1/helmeltrans.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "helmeltrans" 1 1.0.4 "27 Nov 2021" "User Manual"
.TH "helmeltrans" 1 1.0.7 "22 Jul 2022" "User Manual"

.SH NAME
helmeltrans
Expand Down Expand Up @@ -45,8 +45,8 @@ xyz data file format:
export EXAMP=/usr/share/doc/helmert3d/examples/
export ELLIPS=/usr/share/doc/helmert3d/ellipsoids/

helmeltrans xyz $EXAMP/testpoints_blh.txt $ELLIPS/GRS80.txt xyh.txt
helmeltrans blh xyh.txt $ELLIPS/GRS80.txt blh.txt
helmeltrans xyz $EXAMP/testpoints_blh.txt $ELLIPS/GRS80.txt xyz.txt
helmeltrans blh xyz.txt $ELLIPS/GRS80.txt blh.txt
helmdiff3d examples/testpoints_blh.txt blh.txt

.SH COPYRIGHT
Expand All @@ -71,6 +71,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.SH SEE ALSO
helmparms3d(1),
helmert3d(1),
helmtmerc(1),
helmdiff3d(1)

.SH CONTACT
Expand Down
7 changes: 4 additions & 3 deletions man/man1/helmert3d.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "helmert3d" 1 1.0.4 "27 Nov 2021" "User Manual"
.TH "helmert3d" 1 1.0.7 "22 Jul 2022" "User Manual"

.SH NAME
helmert3d
Expand Down Expand Up @@ -63,8 +63,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

.SH SEE ALSO
helmparms3d(1),
helmdiff3d(1),
helmeltrans(1)
helmeltrans(1),
helmtmerc(1),
helmdiff3d(1)

.SH CONTACT
Website: https://github.com/dr-ni/helmert3d
Expand Down
7 changes: 4 additions & 3 deletions man/man1/helmparms3d.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "helmparms3d" 1 1.0.4 "27 Nov 2021" "User Manual"
.TH "helmparms3d" 1 1.0.7 "22 Jul 2022" "User Manual"

.SH NAME
helmparms3d
Expand Down Expand Up @@ -91,8 +91,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

.SH SEE ALSO
helmert3d(1),
helmdiff3d(1),
helmeltrans(1)
helmeltrans(1),
helmtmerc(1),
helmdiff3d(1)

.SH CONTACT
Website: https://github.com/dr-ni/helmert3d
83 changes: 83 additions & 0 deletions man/man1/helmtmerc.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
.TH "helmtmerc" 1 1.0.7 "22 Jul 2022" "User Manual"

.SH NAME
helmtmerc

.SH DESCRIPTION
Transverse Mercator Coordinate Transformation Tool

The transverse Mercator projection in its various forms is the most widely used projected coordinate system for world
topographical and offshore mapping. It is a conformal projection in which a chosen meridian projects to a straight
line at constant scale.

.SH SYNOPSIS
helmeltrans {blh|xyz} src_infilename ellipsoid_infilename [outfilename]

.SH DIRECTION
.TP
xyh
convert B-L-H to x-y-H
.TP
blh
convert x-y-H to B-L-H

.SH FILES
.TP
ellipsoid data file format:

name a b
.TP
zone data file format:

zone_size zone_number [zone_scale] [L0] [x0] [y0]
.TP
blh data file format:

B[1] L[1] H[1]
.. .. ..
.. .. ..
B[n] L[n] H[n]
.TP
xyh data file format:

x[1] y[1] H[1]
.. .. ..
.. .. ..
x[n] y[n] H[n]

.SH EXAMPLE
export EXAMP=/usr/share/doc/helmert3d/examples/
export ELLIPS=/usr/share/doc/helmert3d/ellipsoids/
export ZONES=/usr/share/doc/helmert3d/zones/

helmtmerc xyh $EXAMP/testpoints_blh.txt $ELLIPS/GRS80.txt $ZONES/6g4zone.txt xyh.txt
helmtmerc blh xyh.txt $ELLIPS/GRS80.txt $ZONES/6g4zone.txt blh.txt
helmdiff3d examples/testpoints_blh.txt blh.txt

.SH COPYRIGHT
helmtmerc:

Copyright (c) 2021 U. Niethammer

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

.SH SEE ALSO
helmparms3d(1),
helmert3d(1),
helmeltrans(1),
helmdiff3d(1)

.SH CONTACT
Website: https://github.com/dr-ni/helmert3d
5 changes: 3 additions & 2 deletions src/helmeltrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char* argv[])
char *ofilename = "out.txt";
char *command = "xyz";
char ibuf[256], cbuf[256], name[128];
double a = 6378137.0, b = 6356752.3142, ro, roi;
double a = DEFAULT_A, b = DEFAULT_B, flattening, ro, roi;
double a2, b2, bc, bs, lc, ls, ta, tb, nb, lt, bt, ht, xt, yt, zt;
double x2, y2, z2, r2, r, e2, et2, kf, kg, kc, ks, ks2, kp, kq, r0, re, re2, ku, kv, kz, z0;

Expand Down Expand Up @@ -139,7 +139,8 @@ int main(int argc, char* argv[])
fprintf(stderr,"Error wrong data format in %s\n",cfilename);
exit(EXIT_FAILURE);
}
fprintf(stdout,"Ellipsoid %s, a = %lf, b = %lf\n", name, a, b);
flattening = (a - b) / a;
fprintf(stdout,"Ellipsoid %s, a = %lf, b = %lf, f = %lf\n", name, a, b, flattening);
a2 = a * a;
b2 = b * b;
ro = DEG2RAD;
Expand Down
6 changes: 4 additions & 2 deletions src/helmert3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define VERS "1.0.6"
#define VERS "1.0.7"
#define C_AUTHOR "U. Niethammer"
#define C_YEAR "2021"
#define C_YEAR "2022"
#define DEBUG 0
#define DEG2RAD (M_PI / 180.0)
#define RAD2DEG (180 / M_PI)
#define RAD2SEC (RAD2DEG * 3600)
#define DEFAULT_A 6378137.0
#define DEFAULT_B 6356752.3142

#endif // HELMERT3D_H
Loading

0 comments on commit bd04a58

Please sign in to comment.