Package: liblas / 1.8.1-10

0001-GDAL-interface-no-longer-use-deprecated-API-of-GDAL-.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
Description: GDAL interface: no longer use deprecated API of GDAL 2.3
 GDAL 2.3 use a few most const-safe APIs. Use them
Author: Even Rouault <even.rouault@spatialys.com>
Origin https://github.com/libLAS/libLAS/commit/9c9799d71b621e33dd18ef290bac3ac60fcb35db

--- a/src/gt_citation.cpp
+++ b/src/gt_citation.cpp
@@ -308,7 +308,7 @@ char** CitationStringParse(char* psCitat
 /*                                                                      */
 /*      Set linear unit Citation string                                 */
 /************************************************************************/
-void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName)
+void SetLinearUnitCitation(GTIF* psGTIF, const char* pszLinearUOMName)
 {
     char szName[512];
     CPLString osCitation;
@@ -338,7 +338,7 @@ void SetLinearUnitCitation(GTIF* psGTIF,
 /*                                                                      */
 /*      Set geogcs Citation string                                      */
 /************************************************************************/
-void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, char* angUnitName, int nDatum, short nSpheroid)
+void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, const char* angUnitName, int nDatum, short nSpheroid)
 {
     int bRewriteGeogCitation = FALSE;
     char szName[256];
--- a/src/gt_citation.h
+++ b/src/gt_citation.h
@@ -55,8 +55,8 @@ typedef enum
 OGRBoolean CheckCitationKeyForStatePlaneUTM(GTIF* hGTIF, GTIFDefn* psDefn, OGRSpatialReference* poSRS, OGRBoolean* pLinearUnitIsSet);
 //char* ImagineCitationTranslation(char* psCitation, geokey_t keyID);
 //char** CitationStringParse(char* psCitation, geokey_t keyID);
-void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
-void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, char* angUnitName, int nDatum, short nSpheroid);
+void SetLinearUnitCitation(GTIF* psGTIF, const char* pszLinearUOMName);
+void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, const char* angUnitName, int nDatum, short nSpheroid);
 OGRBoolean SetCitationToSRS(GTIF* hGTIF, char* szCTString, int nCTStringLen,
                             geokey_t geoKey, OGRSpatialReference* poSRS, OGRBoolean* linearUnitIsSet);
 void GetGeogCSFromCitation(char* szGCSName, int nGCSName,
--- a/src/gt_wkt_srs.cpp
+++ b/src/gt_wkt_srs.cpp
@@ -1182,9 +1182,12 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF,
 /*      Create an OGRSpatialReference object corresponding to the       */
 /*      string.                                                         */
 /* -------------------------------------------------------------------- */
-//    poSRS = new OGRSpatialReference();
-    poSRS = (OGRSpatialReference*)OSRNewSpatialReference(NULL);
+    poSRS = new OGRSpatialReference();
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+    if( poSRS->importFromWkt(pszOGCWKT) != OGRERR_NONE )
+#else
     if( poSRS->importFromWkt((char **) &pszOGCWKT) != OGRERR_NONE )
+#endif
     {
         OGRSpatialReference::DestroySpatialReference(poSRS);
         return FALSE;
@@ -1217,7 +1220,7 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF,
         dfSemiMajor = 0.0;
         dfInvFlattening = 0.0;
     }
-    
+
 /* -------------------------------------------------------------------- */
 /*      Get the Datum so we can special case a few PCS codes.           */
 /* -------------------------------------------------------------------- */
@@ -1250,7 +1253,11 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF,
 /* -------------------------------------------------------------------- */
 /*      Get the linear units.                                           */
 /* -------------------------------------------------------------------- */
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+    const char  *pszLinearUOMName = NULL;
+#else
     char        *pszLinearUOMName = NULL;
+#endif
     double	dfLinearUOM = poSRS->GetLinearUnits( &pszLinearUOMName );
     int         nUOMLengthCode = 9001; /* meters */
 
@@ -2151,8 +2158,11 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF,
 /*      Write angular units.  Always Degrees for now.                   */
 /*   Changed to support different angular units                         */
 /* -------------------------------------------------------------------- */
-
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+    const char* angUnitName = NULL;
+#else
     char* angUnitName = NULL;
+#endif
     double angUnitValue = poSRS->GetAngularUnits(&angUnitName);
     if(EQUAL(angUnitName, "Degree"))
         GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1, 
--- a/src/spatialreference.cpp
+++ b/src/spatialreference.cpp
@@ -605,8 +605,12 @@ std::string SpatialReference::GetWKT(WKT
 
         if (pretty) {
             OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+            poSRS->importFromWkt( pszWKT );
+#else
             char *pszOrigWKT = pszWKT;
             poSRS->importFromWkt( &pszOrigWKT );
+#endif
 
             CPLFree( pszWKT );
             pszWKT = NULL;
@@ -626,8 +630,12 @@ std::string SpatialReference::GetWKT(WKT
             && strstr(pszWKT,"COMPD_CS") != NULL )
         {
             OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+            poSRS->importFromWkt( pszWKT );
+#else
             char *pszOrigWKT = pszWKT;
             poSRS->importFromWkt( &pszOrigWKT );
+#endif
 
             CPLFree( pszWKT );
             pszWKT = NULL;
@@ -664,7 +672,7 @@ void SpatialReference::SetFromUserInput(
 
     // OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
     OGRSpatialReference srs(NULL);
-    if (OGRERR_NONE != srs.SetFromUserInput(const_cast<char *> (input)))
+    if (OGRERR_NONE != srs.SetFromUserInput(input))
     {
         throw std::invalid_argument("could not import coordinate system into OSRSpatialReference SetFromUserInput");
     }
@@ -763,7 +771,11 @@ std::string SpatialReference::GetProj4()
     const char* poWKT = wkt.c_str();
 
     OGRSpatialReference srs(NULL);
+#if GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR == 2 && GDAL_VERSION_MINOR >= 3)
+    if (OGRERR_NONE != srs.importFromWkt(poWKT))
+#else
     if (OGRERR_NONE != srs.importFromWkt(const_cast<char **> (&poWKT)))
+#endif
     {
         return std::string();
     }