From d6aaddc5e0cb2bd9080a8fc4b77de947172c81d8 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Mon, 4 Feb 2019 14:48:52 +0100 Subject: [PATCH] Remove all traces of nad2bin and nad2nad The source material for the default grids used by PROJ has been moved to the proj-datumgrid repository. For that reason it is no longer necessary to include the nad2bin program in the PROJ repository and source distribution. From now on the nad2bin application will be kept in the proj-datumgrid repo. Previously the null grid was generated by running nad2bin on the null.lla file. Since nad2bin is no longer available null.lla has been replaced by its binary counterpart null. This file will be distributed and installed alongside PROJ. Build scripts and documenation has been adjusted so that nad2bin is not mentioned anywhere. Additionally all references to nad2nad has been removed as well. nad2nad has not been part of the PROJ distribution for quite some time so this has been long overdue. --- cmake/ProjUtilities.cmake | 55 +--- data/CMakeLists.txt | 11 - data/Makefile.am | 32 +-- data/README | 7 +- data/install.in | 26 -- data/null | Bin 0 -> 232 bytes data/null.lla | 5 - docs/source/usage/transformation.rst | 3 +- man/man1/nad2nad.1 | 195 -------------- src/CMakeLists.txt | 6 - src/Makefile.am | 6 +- src/apps/nad2bin.cpp | 382 --------------------------- src/bin_nad2bin.cmake | 17 -- src/nad_list.h | 6 - 14 files changed, 12 insertions(+), 739 deletions(-) create mode 100644 data/null delete mode 100644 data/null.lla delete mode 100644 man/man1/nad2nad.1 delete mode 100644 src/apps/nad2bin.cpp delete mode 100644 src/bin_nad2bin.cmake delete mode 100644 src/nad_list.h diff --git a/cmake/ProjUtilities.cmake b/cmake/ProjUtilities.cmake index 6969a66449..72373719c1 100644 --- a/cmake/ProjUtilities.cmake +++ b/cmake/ProjUtilities.cmake @@ -111,57 +111,4 @@ function(proj_target_output_name TARGET_NAME OUTPUT_NAME) endif() set(${OUTPUT_NAME} ${TARGET_NAME}${SUFFIX} PARENT_SCOPE) -endfunction() - - -# -# conversion from lla name to lla convert name ( without lla extension) -# - -function(proj_lla_output_name LLA_INPUT_NAME LLA_OUTPUT_NAME ) - get_filename_component(filename ${LLA_INPUT_NAME} NAME_WE) - get_filename_component(pathname ${LLA_INPUT_NAME} PATH) - set(${LLA_OUTPUT_NAME} ${pathname}/${filename} PARENT_SCOPE) - set(${LLA_OUTPUT_NAME} ${pathname}/${filename} PARENT_SCOPE) -endfunction() - -function(proj_lla_target_name LLA_INPUT_NAME LLA_TARGET ) - get_filename_component(filename ${LLA_INPUT_NAME} NAME_WE) - set(${LLA_TARGET} ${filename} PARENT_SCOPE) -endfunction() - -# -# in place conversion of lla file to gsb -# - -function(proj_convert_grid_lla2gsb GRID_DIRECTORY) - set(NAD2BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set(NAD2BIN_PATH ${NAD2BIN_DIR}/nad2bin${CMAKE_EXECUTABLE_SUFFIX}) - file(TO_NATIVE_PATH ${NAD2BIN_PATH} NAD2BIN_EXE) - file(GLOB LLA_FILES ${${GRID_DIRECTORY}}/*.lla) - foreach(LLA ${LLA_FILES} ) - proj_lla_output_name(${LLA} DEST_FILE) - file(TO_NATIVE_PATH ${DEST_FILE} DEST) - proj_lla_target_name(${LLA} LLA_TARGET) - if(NOT EXISTS ${DEST}) - add_custom_target( ${LLA_TARGET} ALL - COMMAND ${NAD2BIN_EXE} ${DEST} "<" ${LLA} - DEPENDS nad2bin ) - endif(NOT EXISTS ${DEST}) - endforeach(LLA) -endfunction() - -# -# add lla output list to an existing file list -# - -function(proj_append_lla_output_file LLA_INPUT_FILE FILE_LIST) - set(LIST_OUT ${${FILE_LIST}}) - foreach(LLA ${${LLA_INPUT_FILE}} ) - proj_lla_output_name(${LLA} DEST_FILE) - file(TO_NATIVE_PATH ${DEST_FILE} DEST) - set(LIST_OUT ${LIST_OUT} ${DEST_FILE} ) - endforeach(LLA ${LLA_INPUT_FILE}) - set(${FILE_LIST} ${LIST_OUT} PARENT_SCOPE) -endfunction() - +endfunction() \ No newline at end of file diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 859f9a6090..8d3a06b288 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -22,17 +22,6 @@ file(GLOB GTX_FILES *.gtx) set(GRIDSHIFT_FILES ${GSB_FILES} ${GTX_FILES}) set(GRIDSHIFT_FILES ${GRIDSHIFT_FILES} ) -option(CONVERT_DATA "convert some ascii file to binary file for use in proj4" OFF) -if(CONVERT_DATA) - if (BUILD_NAD2BIN) - set(LLA_GRID_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - proj_convert_grid_lla2gsb(LLA_GRID_DIR) - file(GLOB LLA_FILES *.lla) - proj_append_lla_output_file(LLA_FILES GRIDSHIFT_FILES) - else() - message(ERROR " you need to compile nad2bin exe in order to convert data file" ) - endif(BUILD_NAD2BIN) -endif(CONVERT_DATA) set(ALL_SQL_IN "${CMAKE_CURRENT_SOURCE_DIR}/all.sql.in") set(PROJ_DB "${CMAKE_CURRENT_SOURCE_DIR}/proj.db") diff --git a/data/Makefile.am b/data/Makefile.am index 3e98e59fe3..8234c03416 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,7 +1,7 @@ DATAPATH = $(top_srcdir)/data pkgdata_DATA = GL27 nad.lst nad27 nad83 world other.extra \ - CH \ + CH null \ ITRF2000 ITRF2008 ITRF2014 proj.db SQL_ORDERED_LIST = sql/begin.sql \ @@ -40,34 +40,12 @@ EXTRA_DIST = GL27 nad.lst nad27 nad83 \ world other.extra \ CH \ ITRF2000 ITRF2008 ITRF2014 \ - CMakeLists.txt tests/test_nodata.gtx null.lla \ + CMakeLists.txt tests/test_nodata.gtx null \ generate_all_sql_in.cmake sql_filelist.cmake \ $(SQL_ORDERED_LIST) -process-nad2bin: - @if [ -f $(DATAPATH)/null.lla -a ! -f null ] || [ -f $(DATAPATH)/conus.lla -a ! -f conus ] ; then \ - for x in $(DATAPATH)/*.lla ; do \ - DEST=`basename $$x .lla`; \ - echo "../src/nad2bin$(EXEEXT) $$DEST < $$x"; \ - ../src/nad2bin$(EXEEXT) $$DEST < $$x ; \ - done; \ - fi - -install-data-local: process-nad2bin +install-data-local: $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) - @if [ -f $(DATAPATH)/null.lla -a ! -f $(DATAPATH)/null ] || [ -f $(DATAPATH)/conus.lla -a ! -f $(DATAPATH)/conus ] ; then \ - for x in $(DATAPATH)/*.lla ; do \ - DEST=$(DESTDIR)$(pkgdatadir)/`basename $$x .lla`; \ - echo "../src/nad2bin$(EXEEXT) $$DEST < $$x"; \ - ../src/nad2bin$(EXEEXT) $$DEST < $$x ; \ - if [ $$? -ne 0 ] ; then \ - echo "nad2bin$(EXEEXT) failed to install $$DEST"; \ - exit 1; \ - fi; \ - done; \ - else \ - echo "nad2nad NADCON source files not present"; \ - fi @for gridfile in $(DATAPATH)/*.gsb $(DATAPATH)/*.gtx $(DATAPATH)/ntv1_can.dat dummy \ $(DATAPATH)/alaska $(DATAPATH)/conus $(DATAPATH)/hawaii $(DATAPATH)/null \ $(DATAPATH)/prvi $(DATAPATH)/stgeorge $(DATAPATH)/stlrnc $(DATAPATH)/stpaul \ @@ -97,9 +75,9 @@ proj.db: $(DATAPATH)/sql/*.sql exit 1; \ fi - + # For out-of-tree builds, link all file of the source data dir to the generated data -check-local: process-nad2bin +check-local: @if [ ! -f GL27 ]; then \ for x in $(DATAPATH)/*; do \ ln -sf $$x .; \ diff --git a/data/README b/data/README index 1b18dd2fa1..ae69072960 100644 --- a/data/README +++ b/data/README @@ -1,5 +1,4 @@ -The files in this directory are support data for PROJ programs -as well as test scripts for testing proj installation. +The files in this directory are support data for PROJ programs. File Contents: @@ -28,7 +27,7 @@ nad.lst --- Reference list of SPCS States and NGS datum identifiers IGNF --- Translation of French Mapping Agency codes into PROJ via init= mechanism. -install --- Unix shell (sh) script to install nad2nad file and proj - init files. Read beginning for usage instructions. +install --- Unix shell (sh) script to install proj init files. + Read beginning for usage instructions. Additional data files are available in https://github.com/OSGeo/proj-datumgrid/ diff --git a/data/install.in b/data/install.in index d60dc72583..98b2c8466e 100755 --- a/data/install.in +++ b/data/install.in @@ -23,31 +23,5 @@ do echo "file $x installed" fi done -# just test for conus and assume others are there -if [ -f conus.lla ] ; then -# install nad2nad NADCON files - echo "installing ${lib}/nad2783" - lib=${lib}/nad2783 - if [ ! -d $lib ] ; then - mkdir $lib - if [ $? -ne 0 ] ; then - echo "failed to make dir $lib" - echo "nad2nad lib install stopped" - exit 1 - fi - fi -# Process ascii grid into nad2nad compatible files. - for x in *.lla ; do - dest=`expr $x : '\(.*\)\.lla'` - cat < $x | ../src/nad2bin ${lib}/${dest} - if [ $? -ne 0 ] ; then - echo "nad2nad file install failed on file ${lib}/${dest}" - exit 1 - fi - echo "${lib}/${dest} installed" - done -else - echo "nad2nad NADCON files not present" -fi echo "normal completion" exit 0 diff --git a/data/null b/data/null new file mode 100644 index 0000000000000000000000000000000000000000..8418408be229256cc8197447024f7e0e50129513 GIT binary patch literal 232 zcmZ<`adh%=RR}ZEGf)5lztWr>g_5GgyyCR{qFeR`S#2}13{S9005cg8qELz literal 0 HcmV?d00001 diff --git a/data/null.lla b/data/null.lla deleted file mode 100644 index eb25285aac..0000000000 --- a/data/null.lla +++ /dev/null @@ -1,5 +0,0 @@ -Null transform for whole world - 3 3 1 -180.00000 180.00000 -90.00000 90.00000 -0: 0 0 0 0 0 0 -1: 0 0 0 0 0 0 -2: 0 0 0 0 0 0 diff --git a/docs/source/usage/transformation.rst b/docs/source/usage/transformation.rst index bc5c3b1b0d..da856a01a3 100644 --- a/docs/source/usage/transformation.rst +++ b/docs/source/usage/transformation.rst @@ -210,8 +210,7 @@ at each grid location. Actually grid shifts are normally computed based on an interpolation between the containing four grid points. PROJ supports use of grid files for shifting between various reference frames. -The grid shift table formats are ctable (the binary format produced by the PROJ -``nad2bin`` program), NTv1 (the old Canadian format), and NTv2 (``.gsb`` - the new +The grid shift table formats are ctable, NTv1 (the old Canadian format), and NTv2 (``.gsb`` - the new Canadian and Australian format). The text in this section is based on the *cs2cs* framework. Gridshifting is off diff --git a/man/man1/nad2nad.1 b/man/man1/nad2nad.1 deleted file mode 100644 index 96db40499b..0000000000 --- a/man/man1/nad2nad.1 +++ /dev/null @@ -1,195 +0,0 @@ -.\" release 5 -.\" -.ad b -.hy 1 -.TH NAD2NAD 1 "2018/02/15 Rel. 5.0.0" -.SH NAME -nad2nad \- North American Datum conversion filter -.SH SYNOPSIS -.B nad2nad -[ -.B \-eEfihortwW -[ -.I args -] ] [ -.B +args -] -file[s] -.SH DESCRIPTION -Program -.B nad2nad -is a filter to convert data between North -America Datum 1927 (NAD27) and North American Datum 1983. -.B nad2nad -can optionally process both State Plane Coordinate System (SPCS) and -Universal Transverse Mercator (UTM) grid data as well -as geographic data for both input and output. This can also be -accomplished with the \fIcs2cs\fR program. -.PP -The following control parameters can appear in any order: -.TP -.BI \-[i|o] " keyword[,keyword]" -The -.B \-i -and -.B \-o -option expect keyword arguments which define various characteristics and -processing modes of the -respective input data. -Usage allows multiple arguments to be included with a \- operator -when separated by commas. -Datum conversion requires the data to be in geographic coordinates, but -.B nad2nad -will allow conversion of data to and from SPCS or UTM grid systems. -The following are keywords and arguments recognized by both the -.B \-i -and -.B \-o -that will apply to respective input and output conversion of user -data to internal geographic coordinates: -.RS 1in -.TP -.B 27|83 -datum of data -.TP -.BI utm= n -.B UTM -coordinates in meters for zone -.I n -.TP -.BI spcs= n -for data in -.B SPCS -coordinates, where -.I n -is state zone number. -.TP -.B feet -data units are in U.S. Surveyor's feet. -This is allowed only when the -.I spcs -option been previously used. -Default coordinates are in meters. -.TP -.B bin -for data in binary form. -.TP -.B rev -data in lat-lon order rather than default lon-lat order. -.TP -.BI hp= ss -use high precision conversion zone -.I ss. -Certain States have ancillary correction tables to further refine -the basic conus table. -.I Ss -key and States are: -.RS .5in -FL Florida -.br -MD Maryland -.br -TN Tennessee -.br -WI Wisconsin -.br -WO Washington, Oregon and northern part of California. -.RE -.RE -.TP -.BI \-t "a" -.I A -specifies a character employed as the first character to denote -a control line to be passed through without processing. -This option applicable to ascii input only. -(# is the default value). -.TP -.BI \-e " string" -.I String -is an arbitrary string to be output if an error is detected during -data transformations. -The default value is: *\et*. -Note that if the -.B "\-o bin" -option is employed, an error is output as HUGE_VAL for both values. -.TP -.BI \-r " region" -specifies which regional conversion table to employ which are identified -by the following: -.RS .5in -conus \- conterminous 48 States -.br -alaska \- State of Alaska -.br -hawaii \- State of Hawaii -.br -prvi \- Puerto Rico and Virgin Islands -.br -stgeorge \- St. George Is, Alaska -.br -stpaul \- St. Paul Is, Alaska -.br -stlrnc \- St. Lawrence Is, Alaska -.TP -.B \-E -Input coordinates are echoed to output before output values. -.RE -.TP -.BI \-f " format" -.I Format -is a -.I printf -format string to control the form of the output values. -For inverse projections, the output will be in degrees when this option -is employed. -If a format is specified for inverse projection the -output data will be in decimal degrees. -The default format is \(``%.2f\('' for forward projection and DMS -for inverse. -.TP -.BI \-[w|W] n -.I N -is the number of significant fractional digits to employ for -seconds output (when the option is not specified, -.B \-w3 -is assumed). -When -.B \-W -is employed the fields will be constant width and with leading zeroes. -.PP -One or more -.I files -(processed in left to right order) -specify the source of data to be transformed. -A \- will specify the location of processing standard input. -If no files are specified, the input is assumed to be from -.I stdin. -For ASCII input data the two data values must be in the -first two white space separated fields and -when both input and output are ASCII all trailing portions -of the input line are appended to the output line. -.PP -Input geographic data -(longitude and latitude) must be in DMS format when neither -.I utm -nor -.I spcs -is specified, otherwise in meters or feet (\fIfeet\fR option used). -Input data fields must be separated by white space and not have -imbedded white space. -.PP -Output data will be in tab separated fields of DMS or grid -coordinates in meters or feet. -.PP -Any data after the two input values are echoed after the two -output data values. -.SH SEE ALSO -.B cs2cs(1U), proj(1U), -.br -.I "Cartographic Projection Procedures for the UNIX Environment\(emA User's Manual," -(Evenden, 1990, Open-file report 90\-284). -.SH BUGS -A list of known bugs can found at https://github.com/OSGeo/proj.4/issues -where new bug reports can be submitted too. -.SH HOME PAGE -https://proj4.org/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de8ca3e582..122227bf4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,6 @@ option(BUILD_CCT "Build cct (coordinate conversion and transformation tool)" option(BUILD_CS2CS "Build cs2cs (coordinate systems to coordinate systems translation tool)" ON) option(BUILD_GEOD "Build geod (computation of geodesic lines)" ON) option(BUILD_GIE "Build gie (geospatial integrity investigation environment - a PROJ.4 test tool)" ON) -option(BUILD_NAD2BIN "Build nad2bin (format conversion tool)" ON) option(BUILD_PROJ "Build proj (cartographic projection tool : latlong <-> projected coordinates)" ON) option(BUILD_PROJINFO "Build projinfo (SRS and coordinate operation metadata/query tool)" ON) @@ -50,11 +49,6 @@ if(BUILD_GEOD) set(BIN_TARGETS ${BIN_TARGETS} geod) endif(BUILD_GEOD) -if(BUILD_NAD2BIN) - include(bin_nad2bin.cmake) - set(BIN_TARGETS ${BIN_TARGETS} nad2bin) -endif(BUILD_NAD2BIN) - if(BUILD_PROJ) include(bin_proj.cmake) set(BIN_TARGETS ${BIN_TARGETS} binproj) diff --git a/src/Makefile.am b/src/Makefile.am index fabea4bf95..bf1cd32c8c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ AM_CFLAGS = @C_WFLAGS@ -bin_PROGRAMS = proj nad2bin geod cs2cs gie cct projinfo +bin_PROGRAMS = proj geod cs2cs gie cct projinfo EXTRA_PROGRAMS = multistresstest test228 TESTS = geodtest @@ -14,7 +14,7 @@ include_HEADERS = proj.h proj_experimental.h proj_constants.h proj_api.h geodesi org_proj4_PJ.h proj_symbol_rename.h EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \ - bin_geod.cmake bin_nad2bin.cmake bin_proj.cmake bin_projinfo.cmake \ + bin_geod.cmake bin_proj.cmake bin_projinfo.cmake \ lib_proj.cmake CMakeLists.txt bin_geodtest.cmake tests/geodtest.cpp \ wkt1_grammar.y wkt2_grammar.y apps/emess.h @@ -22,7 +22,6 @@ proj_SOURCES = apps/proj.cpp apps/emess.cpp projinfo_SOURCES = apps/projinfo.cpp cs2cs_SOURCES = apps/cs2cs.cpp apps/emess.cpp cct_SOURCES = apps/cct.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h -nad2bin_SOURCES = apps/nad2bin.cpp geod_SOURCES = apps/geod.cpp apps/geod_set.cpp apps/geod_interface.cpp apps/geod_interface.h apps/emess.cpp gie_SOURCES = apps/gie.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h @@ -35,7 +34,6 @@ cs2cs_LDADD = libproj.la geod_LDADD = libproj.la proj_LDADD = libproj.la projinfo_LDADD = libproj.la -nad2bin_LDADD = libproj.la gie_LDADD = libproj.la multistresstest_LDADD = libproj.la @THREAD_LIB@ diff --git a/src/apps/nad2bin.cpp b/src/apps/nad2bin.cpp deleted file mode 100644 index a684b0877a..0000000000 --- a/src/apps/nad2bin.cpp +++ /dev/null @@ -1,382 +0,0 @@ -/* Convert bivariate ASCII NAD27 to NAD83 tables to NTv2 binary structure */ -#include -#include - -#define PJ_LIB__ -#include "proj_internal.h" -#include "proj_internal.h" -#define U_SEC_TO_RAD 4.848136811095359935899141023e-12 - -/************************************************************************/ -/* swap_words() */ -/* */ -/* Convert the byte order of the given word(s) in place. */ -/************************************************************************/ - -static const int byte_order_test = 1; -#define IS_LSB (((const unsigned char *) (&byte_order_test))[0] == 1) - -static void swap_words( void *data_in, int word_size, int word_count ) - -{ - int word; - unsigned char *data = (unsigned char *) data_in; - - for( word = 0; word < word_count; word++ ) - { - int i; - - for( i = 0; i < word_size/2; i++ ) - { - unsigned char t; - - t = data[i]; - data[i] = data[word_size-i-1]; - data[word_size-i-1] = t; - } - - data += word_size; - } -} - -/************************************************************************/ -/* Usage() */ -/************************************************************************/ - -static void Usage() -{ - fprintf(stderr, - "usage: nad2bin [-f ctable/ctable2/ntv2] binary_output < ascii_source\n" ); - exit(1); -} - -/************************************************************************/ -/* main() */ -/************************************************************************/ -int main(int argc, char **argv) { - struct CTABLE ct; - FLP *p, t; - size_t tsize; - int i, j, ichk; - long lam, laml, phi, phil; - FILE *fp; - - const char *output_file = nullptr; - - const char *format = "ctable2"; - const char *GS_TYPE = "SECONDS"; - const char *VERSION = ""; - const char *SYSTEM_F = "NAD27"; - const char *SYSTEM_T = "NAD83"; - const char *SUB_NAME = ""; - const char *CREATED = ""; - const char *UPDATED = ""; - -/* ==================================================================== */ -/* Process arguments. */ -/* ==================================================================== */ - for( i = 1; i < argc; i++ ) - { - if( i < argc-1 && strcmp(argv[i],"-f") == 0 ) - { - format = argv[++i]; - } - else if( output_file == nullptr ) - { - output_file = argv[i]; - } - else - Usage(); - } - - if( output_file == nullptr ) - Usage(); - - fprintf( stdout, "Output Binary File Format: %s\n", format ); - -/* ==================================================================== */ -/* Read the ASCII Table */ -/* ==================================================================== */ - - memset(ct.id,0,MAX_TAB_ID); - if ( nullptr == fgets(ct.id, MAX_TAB_ID, stdin) ) { - perror("fgets"); - exit(1); - } - /* cppcheck-suppress invalidscanf */ - if ( EOF == scanf("%d %d %*d %lf %lf %lf %lf", &ct.lim.lam, &ct.lim.phi, - &ct.ll.lam, &ct.del.lam, &ct.ll.phi, &ct.del.phi) ) { - perror("scanf"); - exit(1); - } - if (!(ct.cvs = (FLP *)malloc(tsize = ct.lim.lam * ct.lim.phi * - sizeof(FLP)))) { - perror("mem. alloc"); - exit(1); - } - ct.ll.lam *= DEG_TO_RAD; - ct.ll.phi *= DEG_TO_RAD; - ct.del.lam *= DEG_TO_RAD; - ct.del.phi *= DEG_TO_RAD; - /* load table */ - p = ct.cvs; - for (i = 0; i < ct.lim.phi; ++i) { - /* cppcheck-suppress invalidscanf */ - if ( EOF == scanf("%d:%ld %ld", &ichk, &laml, &phil) ) { - perror("scanf on row"); - exit(1); - } - if (ichk != i) { - fprintf(stderr,"format check on row\n"); - exit(1); - } - t.lam = (float) (laml * U_SEC_TO_RAD); - t.phi = (float) (phil * U_SEC_TO_RAD); - *p++ = t; - for (j = 1; j < ct.lim.lam; ++j) { - /* cppcheck-suppress invalidscanf */ - if ( EOF == scanf("%ld %ld", &lam, &phi) ) { - perror("scanf on column"); - exit(1); - } - t.lam = (float) ((laml += lam) * U_SEC_TO_RAD); - t.phi = (float) ((phil += phi) * U_SEC_TO_RAD); - *p++ = t; - } - } - if (feof(stdin)) { - fprintf(stderr, "premature EOF\n"); - exit(1); - } - -/* ==================================================================== */ -/* Write out the old ctable format - this is machine and byte */ -/* order specific. */ -/* ==================================================================== */ - if( strcmp(format,"ctable") == 0 ) - { - if (!(fp = fopen(output_file, "wb"))) { - perror(output_file); - exit(2); - } - if (fwrite(&ct, sizeof(ct), 1, fp) != 1 || - fwrite(ct.cvs, tsize, 1, fp) != 1) { - fprintf(stderr, "output failure\n"); - exit(2); - } - fclose( fp ); - exit(0); /* normal completion */ - } - -/* ==================================================================== */ -/* Write out the old ctable format - this is machine and byte */ -/* order specific. */ -/* ==================================================================== */ - if( strcmp(format,"ctable2") == 0 ) - { - char header[160]; - - if (!(fp = fopen(output_file, "wb"))) { - perror(output_file); - exit(2); - } - - /* cppcheck-suppress sizeofCalculation */ - STATIC_ASSERT( MAX_TAB_ID == 80 ); - /* cppcheck-suppress sizeofCalculation */ - STATIC_ASSERT( sizeof(pj_int32) == 4 ); /* for ct.lim.lam/phi */ - - memset( header, 0, sizeof(header) ); - - memcpy( header + 0, "CTABLE V2.0 ", 16 ); - memcpy( header + 16, ct.id, 80 ); - memcpy( header + 96, &ct.ll.lam, 8 ); - memcpy( header + 104, &ct.ll.phi, 8 ); - memcpy( header + 112, &ct.del.lam, 8 ); - memcpy( header + 120, &ct.del.phi, 8 ); - memcpy( header + 128, &ct.lim.lam, 4 ); - memcpy( header + 132, &ct.lim.phi, 4 ); - - /* force into LSB format */ - if( !IS_LSB ) - { - swap_words( header + 96, 8, 4 ); - swap_words( header + 128, 4, 2 ); - swap_words( ct.cvs, 4, ct.lim.lam * 2 * ct.lim.phi ); - } - - if( fwrite( header, sizeof(header), 1, fp ) != 1 ) { - perror( "fwrite" ); - exit( 2 ); - } - - if (fwrite(ct.cvs, tsize, 1, fp) != 1) { - perror( "fwrite" ); - exit(2); - } - - fclose( fp ); - exit(0); /* normal completion */ - } - -/* ==================================================================== */ -/* Write out the NTv2 format grid shift file. */ -/* ==================================================================== */ - if( strcmp(format,"ntv2") == 0 ) - { - if (!(fp = fopen(output_file, "wb"))) - { - perror(output_file); - exit(2); - } - -/* -------------------------------------------------------------------- */ -/* Write the file header. */ -/* -------------------------------------------------------------------- */ - { - char achHeader[11*16]; - - memset( achHeader, 0, sizeof(achHeader) ); - - memcpy( achHeader + 0*16, "NUM_OREC", 8 ); - achHeader[ 0*16 + 8] = 0xb; - - memcpy( achHeader + 1*16, "NUM_SREC", 8 ); - achHeader[ 1*16 + 8] = 0xb; - - memcpy( achHeader + 2*16, "NUM_FILE", 8 ); - achHeader[ 2*16 + 8] = 0x1; - - memcpy( achHeader + 3*16, "GS_TYPE ", 16 ); - memcpy( achHeader + 3*16+8, GS_TYPE, MIN(16,strlen(GS_TYPE)) ); - - memcpy( achHeader + 4*16, "VERSION ", 16 ); - memcpy( achHeader + 4*16+8, VERSION, MIN(16,strlen(VERSION)) ); - - memcpy( achHeader + 5*16, "SYSTEM_F ", 16 ); - memcpy( achHeader + 5*16+8, SYSTEM_F, MIN(16,strlen(SYSTEM_F)) ); - - memcpy( achHeader + 6*16, "SYSTEM_T ", 16 ); - memcpy( achHeader + 6*16+8, SYSTEM_T, MIN(16,strlen(SYSTEM_T)) ); - - memcpy( achHeader + 7*16, "MAJOR_F ", 8); - memcpy( achHeader + 8*16, "MINOR_F ", 8 ); - memcpy( achHeader + 9*16, "MAJOR_T ", 8 ); - memcpy( achHeader + 10*16, "MINOR_T ", 8 ); - - fwrite( achHeader, 1, sizeof(achHeader), fp ); - } - -/* -------------------------------------------------------------------- */ -/* Write the grid header. */ -/* -------------------------------------------------------------------- */ - { - unsigned char achHeader[11*16]; - double dfValue; - pj_int32 nGSCount = ct.lim.lam * ct.lim.phi; - PJ_LP ur; - - ur.lam = ct.ll.lam + (ct.lim.lam-1) * ct.del.lam; - ur.phi = ct.ll.phi + (ct.lim.phi-1) * ct.del.phi; - - /* cppcheck-suppress sizeofCalculation */ - STATIC_ASSERT( sizeof(nGSCount) == 4 ); - - memset( achHeader, 0, sizeof(achHeader) ); - - memcpy( achHeader + 0*16, "SUB_NAME ", 16 ); - memcpy( achHeader + 0*16+8, SUB_NAME, MIN(16,strlen(SUB_NAME)) ); - - memcpy( achHeader + 1*16, "PARENT ", 16 ); - memcpy( achHeader + 1*16+8, "NONE", MIN(16,strlen("NONE")) ); - - memcpy( achHeader + 2*16, "CREATED ", 16 ); - memcpy( achHeader + 2*16+8, CREATED, MIN(16,strlen(CREATED)) ); - - memcpy( achHeader + 3*16, "UPDATED ", 16 ); - memcpy( achHeader + 3*16+8, UPDATED, MIN(16,strlen(UPDATED)) ); - - memcpy( achHeader + 4*16, "S_LAT ", 8 ); - dfValue = ct.ll.phi * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 4*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 5*16, "N_LAT ", 8 ); - dfValue = ur.phi * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 5*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 6*16, "E_LONG ", 8 ); - dfValue = -1 * ur.lam * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 6*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 7*16, "W_LONG ", 8 ); - dfValue = -1 * ct.ll.lam * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 7*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 8*16, "LAT_INC ", 8 ); - dfValue = ct.del.phi * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 8*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 9*16, "LONG_INC", 8 ); - dfValue = ct.del.lam * 3600.0 / DEG_TO_RAD; - memcpy( achHeader + 9*16 + 8, &dfValue, 8 ); - - memcpy( achHeader + 10*16, "GS_COUNT", 8 ); - memcpy( achHeader + 10*16+8, &nGSCount, 4 ); - - if( !IS_LSB ) - { - swap_words( achHeader + 4*16 + 8, 8, 1 ); - swap_words( achHeader + 5*16 + 8, 8, 1 ); - swap_words( achHeader + 6*16 + 8, 8, 1 ); - swap_words( achHeader + 7*16 + 8, 8, 1 ); - swap_words( achHeader + 8*16 + 8, 8, 1 ); - swap_words( achHeader + 9*16 + 8, 8, 1 ); - swap_words( achHeader + 10*16 + 8, 4, 1 ); - } - - fwrite( achHeader, 1, sizeof(achHeader), fp ); - } - -/* -------------------------------------------------------------------- */ -/* Write the actual grid cells. */ -/* -------------------------------------------------------------------- */ - { - float *row_buf; - int row; - - row_buf = (float *) pj_malloc(ct.lim.lam * sizeof(float) * 4); - memset( row_buf, 0, sizeof(float)*4 ); - - for( row = 0; row < ct.lim.phi; row++ ) - { - for( i = 0; i < ct.lim.lam; i++ ) - { - FLP *cvs = ct.cvs + (row) * ct.lim.lam - + (ct.lim.lam - i - 1); - - /* convert radians to seconds */ - row_buf[i*4+0] = (float) (cvs->phi * (3600.0 / (M_PI/180.0))); - row_buf[i*4+1] = (float) (cvs->lam * (3600.0 / (M_PI/180.0))); - - /* We leave the accuracy values as zero */ - } - - if( !IS_LSB ) - swap_words( row_buf, 4, ct.lim.lam * 4 ); - - if( fwrite( row_buf, sizeof(float), ct.lim.lam*4, fp ) - != (size_t)( 4 * ct.lim.lam ) ) - { - perror( "write()" ); - exit( 2 ); - } - } - } - - fclose( fp ); - exit(0); /* normal completion */ - } - - fprintf( stderr, "Unsupported format, nothing written.\n" ); - exit( 3 ); -} diff --git a/src/bin_nad2bin.cmake b/src/bin_nad2bin.cmake deleted file mode 100644 index 271aac9386..0000000000 --- a/src/bin_nad2bin.cmake +++ /dev/null @@ -1,17 +0,0 @@ -if(WIN32 AND BUILD_LIBPROJ_SHARED) - message(warning " nad2nad can't be build with a DLL proj library you need a static lib") -endif(WIN32 AND BUILD_LIBPROJ_SHARED) - - -set(NAD2BIN_SRC apps/nad2bin.cpp) -source_group("Source Files\\Bin" FILES ${NAD2BIN_SRC}) - -#Executable -add_executable(nad2bin ${NAD2BIN_SRC}) -target_link_libraries(nad2bin ${PROJ_LIBRARIES}) -install(TARGETS nad2bin - RUNTIME DESTINATION ${BINDIR}) - -if(MSVC AND BUILD_LIBPROJ_SHARED) - target_compile_definitions(nad2bin PRIVATE PROJ_MSVC_DLL_IMPORT=1) -endif() diff --git a/src/nad_list.h b/src/nad_list.h deleted file mode 100644 index f82a2ab7ba..0000000000 --- a/src/nad_list.h +++ /dev/null @@ -1,6 +0,0 @@ -/* projection list for program nad2nad */ -PROJ_HEAD(lcc, "Lambert Conformal Conic") -PROJ_HEAD(omerc, "Oblique Mercator") -PROJ_HEAD(poly, "Polyconic (American)") -PROJ_HEAD(tmerc, "Transverse Mercator") -PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)")