[Git][debian-gis-team/gdal-grass][upstream] New upstream version 1.0.2

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sun Nov 6 11:29:22 GMT 2022



Bas Couwenberg pushed to branch upstream at Debian GIS Project / gdal-grass


Commits:
b0182088 by Bas Couwenberg at 2022-11-06T12:16:35+01:00
New upstream version 1.0.2
- - - - -


2 changed files:

- README.md
- grass.cpp


Changes:

=====================================
README.md
=====================================
@@ -25,11 +25,11 @@ sudo make install
 Access GRASS GIS raster data from GDAL:
 
 ```
-gdalinfo ~/grassdata/nc_spm_08_grass7/PERMANENT/cellhd/elevation
+gdalinfo $HOME/grassdata/nc_spm_08_grass7/PERMANENT/cellhd/elevation
 ```
 
 Access GRASS GIS vector data from GDAL-OGR:
 
 ```
-ogrinfo -so -al ~/grassdata/nc_spm_08_grass7/PERMANENT/vector/zipcodes/head
+ogrinfo -so -al $HOME/grassdata/nc_spm_08_grass7/PERMANENT/vector/zipcodes/head
 ```


=====================================
grass.cpp
=====================================
@@ -95,7 +95,7 @@ class GRASSDataset final: public GDALDataset
 
     struct Cell_head sCellInfo; /* raster region */
 
-    char        *pszProjection;
+    OGRSpatialReference m_oSRS{};
 
     double      adfGeoTransform[6];
 
@@ -103,10 +103,7 @@ class GRASSDataset final: public GDALDataset
     GRASSDataset();
     ~GRASSDataset() override;
 
-    const char *_GetProjectionRef(void) override;
-    const OGRSpatialReference* GetSpatialRef() const override {
-        return GetSpatialRefFromOldGetProjectionRef();
-    }
+    const OGRSpatialReference* GetSpatialRef() const override;
     CPLErr GetGeoTransform( double * ) override;
 
     static GDALDataset *Open( GDALOpenInfo * );
@@ -718,7 +715,7 @@ double GRASSRasterBand::GetNoDataValue( int *pbSuccess )
 
 GRASSDataset::GRASSDataset()
 {
-    pszProjection = NULL;
+    m_oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
 
     adfGeoTransform[0] = 0.0;
     adfGeoTransform[1] = 1.0;
@@ -746,20 +743,15 @@ GRASSDataset::~GRASSDataset()
 
     if ( pszElement )
         G_free ( pszElement );
-
-    G_free( pszProjection );
 }
 
 /************************************************************************/
-/*                          GetProjectionRef()                          */
+/*                          GetSpatialRef()                             */
 /************************************************************************/
 
-const char *GRASSDataset::_GetProjectionRef()
+const OGRSpatialReference *GRASSDataset::GetSpatialRef() const
 {
-    if( pszProjection == NULL )
-        return "";
-    else
-        return pszProjection;
+    return m_oSRS.IsEmpty() ? nullptr : &m_oSRS;
 }
 
 /************************************************************************/
@@ -974,9 +966,12 @@ GDALDataset *GRASSDataset::Open( GDALOpenInfo * poOpenInfo )
 
     projinfo = G_get_projinfo();
     projunits = G_get_projunits();
-    poDS->pszProjection = GPJ_grass_to_wkt ( projinfo, projunits, 0, 0);
+    char* pszWKT = GPJ_grass_to_wkt ( projinfo, projunits, 0, 0);
     if (projinfo) G_free_key_value(projinfo);
     if (projunits) G_free_key_value(projunits);
+    if( pszWKT )
+        poDS->m_oSRS.importFromWkt(pszWKT);
+    G_free( pszWKT );
 
 /* -------------------------------------------------------------------- */
 /*      Create band information objects.                                */



View it on GitLab: https://salsa.debian.org/debian-gis-team/gdal-grass/-/commit/b018208864e7e8b2179162c01666cd7b843fcd9f

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/gdal-grass/-/commit/b018208864e7e8b2179162c01666cd7b843fcd9f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20221106/36e050af/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list