aboutsummaryrefslogtreecommitdiff
path: root/src/pj_gridinfo.c
AgeCommit message (Collapse)Author
2018-10-08NTv1 grid shift: fix file offset for reading of shift values in ntv1_can.datEven Rouault
When investigating the format of NTv1 and comparing PROJ code with the actual header of ntv1_can.dat, I discovered that the longitude & latitude shift values started at offset 192, whereas PROJ assumed that the header was 176 bytes only. This caused PROJ to use the wrong offsets values (shift of one grid sample by longitude). So the effect was moderately visible, especially on the latitude, but when comparing with NTv2, one can see that the longitude value after the fix seems to closer to NTv2. old: echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 60.50022624 -100.50040292 0.00000000 inf new: echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 60.50022403 -100.50041841 0.00000000 inf echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=$HOME/proj/proj-datumgrid/north-america/ntv2_0.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 60.50022348 -100.50041978 0.00000000 inf old: $ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 80.10096789 -70.89746834 0.00000000 inf new: $ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 80.10096858 -70.89749190 0.00000000 inf $ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=$HOME/proj/proj-datumgrid/north-america/ntv2_0.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 80.10096782 -70.89749276 0.00000000 inf
2018-05-15IWYU: Partial PJ_natearth.c..rtodms.cKurt Schwehr
2018-05-04Convert errno literals to corresponding PJD symbolKurt Schwehr
2018-03-21Merge branch 'master' into ctable-nullKristian Evers
2018-03-20Handle the case where nad_ctable2_init returns NULL.Kurt Schwehr
Make CTABLE V2 handling the same as CTABLE. The pj_log call hit a NULL pointer during fuzzing. Found with autofuzz.
2018-03-20Remove final \n from pj_log messages.Kurt Schwehr
There was a mix of pj_log calls with and without a trailing newline. pj_stderr_logger already adds a newline to the end of each msg, so pj_log calls don't need their own.
2018-03-20Track the header size read in pj_gridinfo_initKurt Schwehr
Fixes #875 Found with autofuzz using MSAN: use-of-uninitialized-value
2018-03-14Use a function to dereference a double value, to avoid false positive ↵Even Rouault
warning with older cppcheck versions
2018-03-14Avoid 'Found calculation inside sizeof()' false positive with older cppcheck ↵Even Rouault
versions
2018-03-11Remove 'pj_' prefix from static functionsKristian Evers
Functions should only be prefixed with 'pj_' when they can be used in other parts of the code base and not just within a single file. Takes care of the last step in #675.
2018-02-11Add missing ! in boolean evaluation. Fixes #780.Kristian Evers
2017-12-17Declare non-local variables as const where possibleAaron Puchert
Having non-const variables of static lifetime or even global scope is usually a bad idea. These variables are inherently constants, and this should be enforced. This required marking some functions as not modifying input parameters and marking some pointers as pointers to const. One advantage is that the compiler usually puts const static variables in a read-only code segment, so they can't be modified physically. This can be verified with `nm` (on POSIX systems). To avoid changes to the public API, functions returning non-const pointers to data tables were left intact, but the returned data may not be modified. Internally we prefer using the proj_list_* functions over the pj_get_*_ref functions, because the former return const pointers.
2017-11-27Replace some asserts by compile-time assertionsAaron Puchert
Decisions regarding the size of certain types are always made at compile time, hence this is where the assertion should take place. If the assertions fail, there is now a compiler error.
2017-10-20Handle allocation failure when loading grid files (#616)Aaron Puchert
* Handle allocation failure when loading grid files Continuing #606, we tackle the same issues in the loading and processing of grid files. This should fix potential crashes and memory leaks, and makes sure the global lock is always released. * Use pj_calloc when zero-initialized memory is wanted
2017-10-19Prevent crashes and leaks on allocation failure (#606)Aaron Puchert
* Prevent crashes and leaks on allocation failure Memory allocation can fail. We need to gracefully handle this case and prevent dereferencing null pointers. * Make NULL checks consistent within a file * Properly report allocation errors * Improve cleanup in pj_gc_reader.c * Implement pj_strdup and use instead of strdup The function strdup is not part of ANSI C 89, but a POSIX extension. Therefore we can not rely on it being available on all platforms.
2017-02-26Raise MSVC warning level to /W4Even Rouault
2017-02-26Fix warnings related to -Wshadow -Wnull-dereference -Wfloat-conversionr ↵Even Rouault
-Wmissing-prototypes -Wmissing-declarations
2016-08-18whitespace normalization for proj 4.9.3RC3Howard Butler
2016-05-28Change math constants, similar to PR #372. Use M_ namespace with the de ↵Micah Cochran
facto standard M_PI and its ilk. Change names that are widely used in the project to be in the M_ namespace, so HALFPI becomes M_HALFPI. HALFPI is #defined as M_PI_2 (the defacto standard name). #defines _USE_MATH_DEFINES for MS Visual Studio (I didn't personally test this part, but Appveyor will not build otherwise).
2016-01-24Add support for big-endian NTv2 grids (#345)Even Rouault
2015-10-21Don't fail when reading small GTX files #269Howard Butler
2015-10-05avoid read failure for minimal GTX files #269Howard Butler
2015-05-31Fix extraneous parentheses warning.Elliott Sales de Andrade
This warning indicates maybe we wanted to use assignment and added the extra parentheses to silence that *other* warning about assignment in a conditional. However, we really want a conditional, and the parentheses are due to it being in a macro, so using a yoda conditional avoids the ambiguity and silences the warning.
2015-05-31Remove unused $Id$ keywords.Elliott Sales de Andrade
2015-05-30Fix signed/unsigned comparison warnings.Elliott Sales de Andrade
2015-02-21src/pj_gridinfo.c: remove trailing / from preprocessor line (from Charles ↵Even Rouault
Karney) git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2624 4e78687f-474d-0410-85f9-8d5e500ac6b2
2014-09-17fix NTv2 parent relationship problems (#177)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2548 4e78687f-474d-0410-85f9-8d5e500ac6b2
2014-09-13Fix #231 -- crash when nad_ctable_init returned NULLHoward Butler
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2512 4e78687f-474d-0410-85f9-8d5e500ac6b2
2014-08-19Make pj_gridinfo_load() thread-safe (#228)Even Rouault
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2488 4e78687f-474d-0410-85f9-8d5e500ac6b2
2013-06-22bulk of file api implementation complete and workingFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2345 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-01-25minor formatting improvementsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2142 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-11-22implement support for ctable2 format (read/write)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2121 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-07-06adjust error handling for missing grid shift files (#116)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2067 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-02-10correct gtx bounds reported by debug (#95)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1969 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-08-31Move vertical datum grids in 180 to 360 to -180 to 0. Improve debug andFrank Warmerdam
error logging to use pj_log(). git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1888 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-11avoid type warning.Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1857 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-11roll projCtx through various other low level functionsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1856 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-11preliminary implementation of projCtx APIFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1854 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-05-11preliminary addition of vertical datum shifting capabilityFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1839 4e78687f-474d-0410-85f9-8d5e500ac6b2
2009-01-06removed CVS log messages since they are not maintained by subversionFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1504 4e78687f-474d-0410-85f9-8d5e500ac6b2
2006-11-17Uploaded PROJ.4 port for Windows CE.Mateusz Loskot
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1377 4e78687f-474d-0410-85f9-8d5e500ac6b2
2005-07-07Fixed debug fprintf syntax per:Frank Warmerdam
http://bugzilla.remotesensing.org/show_bug.cgi?id=886 git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1298 4e78687f-474d-0410-85f9-8d5e500ac6b2
2004-10-30fixed reported information in ctable debug messageFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1269 4e78687f-474d-0410-85f9-8d5e500ac6b2
2003-08-20Avoid unsigned char / char casting issues for VC++.Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1154 4e78687f-474d-0410-85f9-8d5e500ac6b2
2003-03-19Fixed so swap_words() works when it should.Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1113 4e78687f-474d-0410-85f9-8d5e500ac6b2
2003-03-17improved debugging, reduce header read sizeFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1101 4e78687f-474d-0410-85f9-8d5e500ac6b2
2003-03-17implement heirarchical NTv2 gridinfosFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1097 4e78687f-474d-0410-85f9-8d5e500ac6b2
2003-03-15NewFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1090 4e78687f-474d-0410-85f9-8d5e500ac6b2