aboutsummaryrefslogtreecommitdiff
path: root/src/projects.h
AgeCommit message (Collapse)Author
2017-10-06Change PJ.left default from PJ_CLASSIC to PJ_RADIANSThomas Knudsen
2017-10-06Enable default destructor for all PJ objects.Thomas Knudsen
In most cases memory deallocation is completely removed from the code since it can be handled by the default destructor. In a few special cases a local destructor overrides the default destructor and makes sure that locally allocated memored is cleaned up correctly. Move all deallocation from pj_free to pj_default_destructor Rename pj_latlong.c to fit with the conventional format PJ_latlong.c - freeup was missed here due to wrong naming Clean up pj_init to avoid double deallocation; Also resolve #576 by adding z_0 and t_0 options in pj_init, while cleaning Add a prototype for dealloc_params Added missing errno.h include in pj_ctx.c Temporarily removing ob_tran from testvarious, to be sure that is where the trouble is Make PJ_ob_tran.c use proper initialization for the chained projection proj=ob_tran: make it clear, that we disallow ellipsoidal projections, and, for improved backwards compatibility, turns off default settings, which could inject unwanted ellipsoid definitions ... then also remove the ellipsoid definition from the testvarious test case - which is probably buggy anyway Work around cs2cs spherical init bug in testvarious; Forbid defs for ob_tran in pj_init
2017-09-28Add PJD_ERR_* aliases for error numbers without oneKristian Evers
2017-09-28Support a default destructor for PJ objectsThomas Knudsen
2017-08-07Adding info functions to proj.h API. (#551)Kristian Evers
* Adding info functions to proj.h API. Four new functions are added with this commit: proj_info(), proj_pj_info(), proj_grid_info() and proj_init_info(). Additionally four new data types are added: PJ_INFO, PJ_PROJ_INFO, PJ_GRID_INFO and PJ_INIT_INFO. The functions return the corresponding data types. These functions allows users of the PROJ.4 library to get information about various PROJ.4 entities and the library itself. The new data types are structs that contain specific information about either the library instance, a PJ instance, a grid or an init file. Together the four new functions cover a big part of the functionality in the semi-public projects.h API and should hopefully make it easier for user to migrate their code to the proj.h API in the future. Besides covering already existing functionality in the old API, this commit introduces the ability to add metadata to init-files. This is primarily added to give users a way of knowing which version of the EPSG database they are using, but it also comes in handy for other init-files. The init-file metadata is added directly to the init-file as a special "projection" called "metadata". The info projection of the epsg init-file is thus described as: <metadata> +version=9.0.0 +origin=EPSG +lastupdate=2017-01-10 The proj_init_info() function uses the internal pj_param() to read the metadata. As a consequence, "metadata" will not be available as a the name of a projection in the future. This is a reasonable price to pay considering the ease of the implementation of adding metadata to init-files this way, and of course that "metadata" is a very unlikely name for a projection in any case. A metadata tag has been added to all init-files in the nad-directory. For most only a subset of the possible parameters has been added. * Replaced calls to sprintf and strncpy with safer options. Added pj_strlcpy for internal use. * Fail gracefully when getting non-initialized PJ in proj_pj_info() * Change length of filename member in PJ_INIT_INFO and PJ_GRID_INFO to 260 (MAX_PATH)
2017-07-18Merge pull request #548 from kbevers/remove-error-macrosKristian Evers
Eliminated *_ERROR* macros.
2017-07-18Expanded *_ERROR* macros.Kristian Evers
Expanded *_ERROR* macros with calls to proj_errno_set() and proper returns when necessary. Defined a bunch of new PJD_ERR_ constants in projects.h that corresponds to the error numbers in pj_strerrno.c. A few unknown error numbers were replaced by existing ones in pj_strerrno.c.
2017-07-14Make sure to use custom hypot() when building as ANSI C (not defined before ↵Kristian Evers
C99).
2017-07-10Introducing the Molodensky transform (#541)Kristian Evers
2017-07-07obs_api revision and improvements: new namespace etc. (#530)Thomas Knudsen
* obs_api revision and improvements: new namespace etc. * Minor corrections: use unused functions, add missing prototype, added fwd/invcoord to PJ * Minor correction: MSVC barfs on va_arg type specification. Trying once more with added parens * Reverting paren correction, which appears to be a non-solution * Significant improvements to the OBS_API, plus a number of corrections, mostly in test code, to reflect API changes * Added two missing prototypes * Adding the proj_transform function and some related checks * Improvements to proj_transform etc. based on suggestions from Even Rouault * Reducing the libc include footprint of proj.h - again based on suggestions from Even Rouault * A few minor corrections * Eliminate a MSVC warning about non-initialized usage. Not an actual issue, as another check has locked the path, but at least this should calm down MSVC * Improved support for the errno reset/restore paradigm * Introduced the internal header proj_internal.h; Moved most non-API stuff from pj_obs_api.c to pj_internal.c * Adding proj_internal.h to HEADERS_LIBPROJ to solve build problems * Correcting a few pj...proj blunders in PJ_pipeline.c * Correcting a few additional blunders in PJ_pipeline.c * Changed angle-brackets to quotation marks in includes of proj_internal.h * Some minor build system repairs * Some PJ_CONTEXT usage simplifications following suggestions by Kristian Evers @kbevers * Added version numbering to proj.h - Fixes #529 * remove proj_errno_restore macro, provide function implementation * Add proj_get_definition. Fixes #538 * Added library specific deallocator proj_buffer_free, eliminating a potential cross heap issues on Windows. Thx to Even Rouault for spotting this * Got rid of a meaningless cast in proj_buffer_free * Added some missing functions to proj.def (again spotted by @rouault); removed some not-yet-implemented material from proj.h * Renamed proj_get_definition/proj_buffer_free to proj_definition_create/proj_definition_destroy, for symmetry and clarity * Renaming the definition handlers to proj_definition_retrieve / proj_free * Renaming proj_free to proj_release
2017-06-08PJ_comill.c: avoid infinite loop in inverse method. Credit to OSS FuzzEven Rouault
2017-06-02Disallow usage of m<0 and n<0 in gn_sinu.Kristian Evers
Negative values of m and n are not valid. Can for certain values of m and n result in zero division. An error is raised at projection setup if m or n is negative. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1836 Credit to OSS-Fuzz.
2017-06-01Disallow +s=0 when in 4-param. mode.Kristian Evers
Avoids zero-division in PJ_helmert.c Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1956 Credit to OSS-Fuzz.
2017-05-19Unit conversion pseudo-projection.Kristian Evers
A pseudo-projection that can be used to convert units of input and output data. Primarily useful in pipelines. Unit conversion is performed by means of a pivot unit. The pivot unit for distance units are the meter and for time we use the modified julian date. A time unit conversion is performed like Unit A -> Modified Julian date -> Unit B distance units are converted in the same manner, with meter being the central unit. The modified Julian date is chosen as the pivout unit since it has a fairly high precision, goes sufficiently long backwards in time, has no danger of hitting the upper limit in the near future and it is a fairly common time unit in astronomy and geodesy. Note that we are using the Julian date and not day. The difference being that the latter is defined as an integer and is thus limited to days in resolution. This approach has been extended wherever it makes sense, e.g. the GPS week unit also has a fractional part that makes it possible to determine the day, hour and minute of an observation. In- and output units are controlled with the parameters +xy_in, +xy_out, +z_in, +z_out, +t_in and +t_out where xy denotes horizontal units, z vertical units and t time units. Distance units are converted similar to what is already in use in PROJ.4. To ease usage of the already defined conversion factors a new column with the factors defined as doubles has been added to the pj_units array. This simplifies the code significantly, since parsing the defined strings can be avoided.
2017-02-27Merge pull request #487 from PositiveArrow/c11_compilationEven Rouault
C11 compilation
2017-02-26Fix warnings related to -Wshadow -Wnull-dereference -Wfloat-conversionr ↵Even Rouault
-Wmissing-prototypes -Wmissing-declarations
2017-02-10Consistent precision for mathematical macrosEtienne Jacques
2017-02-10Fix compilation with gcc with -std=c11 option.Etienne Jacques
2016-12-12Add a scripts/fix_typos.sh script and correct reported errorsEven Rouault
2016-11-20Plumbing for pipelines (#453)Thomas Knudsen
* re-enter pipeline The pipeline interface is now internally based on the pj_obs_api, which simplifies the implementation significantly. This is the first mock up - it compiles fine, but is currently untested * pipeline code cleaned up The pipeline code is now based on the PJ_OBS api (although you can still invoke a pipeline through pj_fwd/pj_inv and their 3D brethren). This has made it possible to eliminate scores of funky casts and convoluted workarounds. The code is now way more straightforward and mostly conforming with common C idioms.. Also, the proj.h / obs_api interface to the logging system has been streamlined through the introduction of the pj_log_error, pj_log_debug, and pj_log_trace functions. * Geodesics + minor changes First proj.h style interface to Charles Karney's geodesics code: pj_lp_dist. Also, renamed pj_apply -> pj_trans * Extended Ellipsoidal Parameters Second eccentricity, second and third flattening etc. * Rename pj_debug_set -> pj_log_level ... and add self test code for PJ_pipeline * Clean up missing pj_apply->pj_trans * Clean up missing pj_obs_dist_2d rename * pj_strerrno bug fixed. Some doc/comments added (In response to a review by @kbevers)
2016-11-12Pipeline plus api - in continuation of the Genereic Coordinates pull request ↵Thomas Knudsen
(#445) This commit reflects continued work on the new rationalized API with geodetic extensions (see rationale in proj.h). It also reflects the parallel work on the transformation pipeline reimplementation, by introducing the PJ_cart cartesian/ellipsoidal converter. See example/pj_obs_api_test.c for demo example code
2016-10-24Generic coordinates (#431)Thomas Knudsen
* Pipeline preliminaries Introducing the PJ_OBSERVATION data type as the basis for generic geodetic transformations. Also introducing the elements of a new minimalistic API focused on generic geodetic transformations. This API is documented in the new proj.h header, and is orthogonal (non-intrusive) wrt. the existing API from proj_api.h Finally added a large amount of comments to the somewhat intractable projects.h, and extended the PJ object with a number of additional ellipsoidal parameters of general geodetic usefulness. The PJ elements fwdobs and invobs extend fwd3d and inv3d in a homologous way to how fwd3d and inv3d extend fwd and inv.
2016-08-22Changed self-test build behaviour from opt-out to opt-inKristian Evers
2016-07-13Eliminated load time non-computable initializers in healpixKristian Evers
2016-05-31correct M_PI_HALFPI valueMicah Cochran
last digit changed to 9
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-04-12refactoring + added selftest for 8 more projectionsThomas Knudsen
calcofi, cass,cc,wag2, wag3, wag7, wink1, wink2
2016-04-07pj_list cleanup + added selftest stubs for all projectionsThomas Knudsen
The projection list maintained by code in pj_list.c depended on stuff in projects.h. This stuff is non-obvious and since it is only used in pj_list.c, it has been moved from projects.h to pj_list.c (The material moved is based on some really clever X-macro techniques implemented by numerous redefinitions of the PROJ_HEAD macro, followed by immediate re-inclusion of te pj_list.h file). Also, the self test runner pj_run_selftests has been remodelled, now depending on a list of self test functions, generated in a similar way to the projection list, and like the projection list generated by X-macro techniques in pj_list.c. For this to work, self test functions need to be available for all projections. To fulfill this, stubs for all projections not having self tests already, have been added to PJ_aea.c Along with the recent build system patches by @kbevers, this first part of the macro-refactoring project is considered close to finished.
2016-04-05Some initial work on internal regression testsThomas Knudsen
Need these to reduce the chance I'm screwing up something during this rather intrusive code surgery
2016-04-01First steps toward simplified macros/internalsThomas Knudsen
The brief version:: In an attempt to make proj.4 code slightly more secure and much easier to read and maintain, I'm trying to eliminate a few unfortunate design decisions from the early days of proj.4 The work will be *very* intrusive, especially in the PJ_xxx segment of the code tree, but great care has been taken to design a process that can be implemented stepwise and localized, one projection at a time, then finalized with a relatively small and concentrated work package. The (very) long version: See the comments in PJ_minimal.c
2016-01-24Add support for big-endian NTv2 grids (#345)Even Rouault
2015-10-27Merge branch 'master' of https://github.com/piyushrpt/proj.4Even Rouault
Conflicts: nad/tv_out.dist
2015-10-24Switch utm to use etmerc to address issue #316.Charles Karney
Add a test to check this. Output of an existing test changed in 7th decimal place.
2015-10-23- API Extension to include fwd3d / inv3dPiyush Agram
- New SCH coordinate system for radar imaging systems
2015-09-11win32 PVALUE issuesisyphus
2015-07-07Make pj_init() locale safe and no longer modify locale (#226)Even Rouault
Remove setlocale() use in pj_init_ctx(), and replace uses of atof() & strtod() by their locale safe variants pj_atof() and pj_strtod(). Proj versions from now advertize #define PJ_LOCALE_SAFE 1 in proj_api.h and export pj_atof() & pj_strtod()
2015-05-31Remove unused $Id$ keywords.Elliott Sales de Andrade
2013-06-25move pj_open_lib() to public include fileFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2356 4e78687f-474d-0410-85f9-8d5e500ac6b2
2013-06-25Remove internal declaration of PROJ_LIB - makes it hard to not have a valueFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2355 4e78687f-474d-0410-85f9-8d5e500ac6b2
2013-06-22add pj_ctx_fgets() implementation (untested)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2347 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
2013-06-22preliminary step implementing virtual fileioFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2344 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-06-19first nearly working grid catalog implementationFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2219 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-06-18preliminary work on grid catalogsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2218 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-03-14avoid using macro expansion directly in #include to simplify codeFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2196 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-05-31include string.h as memset is widely used nowFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2048 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-05-31ensure PJ structure always initialized to zero after malloc (#112)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2045 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-05-10add support for vunits/vto_meter parameters to specify vertical unitsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2000 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-05-10fix up builds on windowsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1999 4e78687f-474d-0410-85f9-8d5e500ac6b2