Skip to content

Instantly share code, notes, and snippets.

@schwehr
Created March 1, 2018 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schwehr/94f4501206363cf83362a2eac2898f7b to your computer and use it in GitHub Desktop.
Save schwehr/94f4501206363cf83362a2eac2898f7b to your computer and use it in GitHub Desktop.
failed attempt at GDAL using PROJ from Sep 2017 (not quite proj 5.0.0)
--- a/ogrct.cpp 2018-01-22 15:11:39.000000000 -0800
+++ b/ogrct.cpp 2018-03-01 09:44:21.000000000 -0800
@@ -41,6 +41,7 @@
#include "ogr_srs_api.h"
#ifdef PROJ_STATIC
+#include "proj.h"
#include "proj_api.h"
#endif
@@ -125,14 +126,14 @@
class OGRProj4CT : public OGRCoordinateTransformation
{
OGRSpatialReference *poSRSSource;
- void *psPJSource;
+ PJ *psPJSource;
bool bSourceLatLong;
double dfSourceToRadians;
bool bSourceWrap;
double dfSourceWrapLong;
OGRSpatialReference *poSRSTarget;
- void *psPJTarget;
+ PJ *psPJTarget;
bool bTargetLatLong;
double dfTargetFromRadians;
bool bTargetWrap;
@@ -324,14 +325,14 @@
*/
static char *OCTProj4NormalizeInternal( const char *pszProj4Src )
{
- projPJ psPJSource = pfn_pj_init_plus( pszProj4Src );
+ PJ *psPJSource = proj_create(PJ_DEFAULT_CTX, pszProj4Src);
if( psPJSource == nullptr )
return CPLStrdup( pszProj4Src );
char *pszNewProj4Def = pfn_pj_get_def( psPJSource, 0 );
- pfn_pj_free( psPJSource );
+ proj_destroy(psPJSource);
if( pszNewProj4Def == nullptr )
return CPLStrdup( pszProj4Src );
@@ -546,22 +547,22 @@
if( pjctx != nullptr )
{
if( psPJSource != nullptr )
- pfn_pj_free( psPJSource );
+ proj_destroy(psPJSource);
if( psPJTarget != nullptr )
- pfn_pj_free( psPJTarget );
+ proj_destroy( psPJTarget );
- pfn_pj_ctx_free(pjctx);
+ pj_ctx_free(pjctx);
}
else
{
CPLMutexHolderD( &hPROJMutex );
if( psPJSource != nullptr )
- pfn_pj_free( psPJSource );
+ proj_destroy( psPJSource );
if( psPJTarget != nullptr )
- pfn_pj_free( psPJTarget );
+ proj_destroy(psPJTarget);
}
CPLFree(padfOriX);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment